Skip to content

Commit

Permalink
Merge pull request #70 from tribe29/devel
Browse files Browse the repository at this point in the history
Prepare release 0.5.0
  • Loading branch information
robin-checkmk authored Jul 8, 2022
2 parents 1817e41 + 05d9f63 commit b9e133e
Show file tree
Hide file tree
Showing 41 changed files with 1,267 additions and 754 deletions.
95 changes: 95 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
# .ansible-lint
# exclude_paths included in this file are parsed relative to this file's location
# and not relative to the CWD of execution. CLI arguments passed to the --exclude
# option will be parsed relative to the CWD of execution.
exclude_paths:
- .cache/ # implicit unless exclude_paths is defined in config
- .github/
- .vagrant/
- changelogs/
- docs/
# parseable: true
# quiet: true
# verbosity: 1

# # Mock modules or roles in order to pass ansible-playbook --syntax-check
# mock_modules:
# - zuul_return
# # note the foo.bar is invalid as being neither a module or a collection
# - fake_namespace.fake_collection.fake_module
# - fake_namespace.fake_collection.fake_module.fake_submodule
# mock_roles:
# - mocked_role
# - author.role_name # old standalone galaxy role
# - fake_namespace.fake_collection.fake_role # role within a collection

# # Enable checking of loop variable prefixes in roles
# loop_var_prefix: "{role}_"

# Enforce variable names to follow pattern below, in addition to Ansible own
# requirements, like avoiding python identifiers. To disable add `var-naming`
# to skip_list.
# var_naming_pattern: "^[a-z_][a-z0-9_]*$"

use_default_rules: true
# Load custom rules from this specific folder
# rulesdir:
# - ./rule/directory/

# This makes linter to fully ignore rules/tags listed below
skip_list:
- experimental

# # Any rule that has the 'opt-in' tag will not be loaded unless its 'id' is
# # mentioned in the enable_list:
# enable_list:
# - empty-string-compare # opt-in
# - no-log-password # opt-in
# - no-same-owner # opt-in
# # add yaml here if you want to avoid ignoring yaml checks when yamllint
# # library is missing. Normally its absence just skips using that rule.
# - yaml
# # Report only a subset of tags and fully ignore any others
# # tags:
# # - var-spacing

# # This makes the linter display but not fail for rules/tags listed below:
# warn_list:
# - skip_this_tag
# - git-latest
# - experimental # experimental is included in the implicit list
# # - role-name

# Some rules can transform files to fix (or make it easier to fix) identified
# errors. `ansible-lint --write` will reformat YAML files and run these transforms.
# By default it will run all transforms (effectively `write_list: ["all"]`).
# You can disable running transforms by setting `write_list: ["none"]`.
# Or only enable a subset of rule transforms by listing rules/tags here.
# write_list:
# - all

# Offline mode disables installation of requirements.yml
offline: true

# # Define required Ansible's variables to satisfy syntax check
# extra_vars:
# foo: bar
# multiline_string_variable: |
# line1
# line2
# complex_variable: ":{;\t$()"

# Uncomment to enforce action validation with tasks, usually is not
# needed as Ansible syntax check also covers it.
# skip_action_validation: false

# # List of additional kind:pattern to be added at the top of the default
# # match list, first match determines the file kind.
# kinds:
# # - playbook: "**/examples/*.{yml,yaml}"
# # - galaxy: "**/folder/galaxy.yml"
# # - tasks: "**/tasks/*.yml"
# # - vars: "**/vars/*.yml"
# # - meta: "**/meta/main.yml"
# - yaml: "**/*.yaml-too"
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
time: "06:00"
open-pull-requests-limit: 10
83 changes: 83 additions & 0 deletions .github/workflows/ansible-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# https://github.com/ansible-collections/collection_template/blob/main/.github/workflows/ansible-test.yml
# README FIRST
# 1. replace "NAMESPACE" and "COLLECTION_NAME" with the correct name in the env section (e.g. with 'community' and 'mycollection')
# 2. If you don't have unit tests remove that section
# 3. If your collection depends on other collections ensure they are installed, see "Install collection dependencies"
# If you need help please ask in #ansible-community on the Libera.chat IRC network

name: Ansible Linting
on:
workflow_dispatch:
push:
paths:
- 'roles/'
pull_request:
paths:
- 'roles/'

env:
NAMESPACE: tribe29
COLLECTION_NAME: checkmk

jobs:

###
# Integration tests (RECOMMENDED)
#
# https://docs.ansible.com/ansible/latest/dev_guide/testing_integration.html


# If the application you are testing is available as a docker container and you want to test
# multiple versions see the following for an example:
# https://github.com/ansible-collections/community.zabbix/tree/master/.github/workflows

integration:
runs-on: ubuntu-latest
name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
strategy:
fail-fast: false
matrix:
python:
- '3.7'
- '3.8'
- '3.9'
- '3.10'

steps:
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Set up Python
uses: actions/setup-python@v2
with:
# it is just required to run that once as "ansible-test integration" in the docker image
# will run on all python versions it supports.
python-version: 3.8

- name: Install ansible-lint
run: pip install ansible-lint yamllint

# Run the linting
- name: Run yamllint on roles
run: yamllint -c .yamllint roles/
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Run yamllint on playbooks
run: yamllint -c .yamllint playbooks/
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Run ansible-lint on roles
run: ansible-lint -c ${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/.ansible-lint ${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/roles/
working-directory: ./ansible_collections/
env:
ANSIBLE_LIBRARY: "./tribe29/checkmk/plugins/modules"
ANSIBLE_ROLES_PATH: "./tribe29/checkmk/roles"

- name: Run ansible-lint on playbooks
run: ansible-lint -c ${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/.ansible-lint ${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/playbooks/
working-directory: ./ansible_collections/
env:
ANSIBLE_LIBRARY: "./tribe29/checkmk/plugins/modules"
ANSIBLE_ROLES_PATH: "./tribe29/checkmk/roles"
12 changes: 4 additions & 8 deletions roles/agent/.yamllint → .yamllint
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
# Based on ansible-lint config
extends: default

rules:
Expand All @@ -15,19 +14,16 @@ rules:
commas:
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
max: 3
level: error
hyphens:
level: error
indentation: disable
indentation: enable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-line-at-end-of-file: enable
new-lines:
type: unix
trailing-spaces: disable
truthy: disable
trailing-spaces: enable
truthy: enable
31 changes: 2 additions & 29 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,8 @@ Vagrant.configure("2") do |config|
apt-get install -y python3-pip
pip install -r /vagrant/requirements.txt
ansible-galaxy collection install -f -r /vagrant/requirements.yml
wget "https://download.checkmk.com/checkmk/2.0.0p25/check-mk-raw-2.0.0p25_0.focal_amd64.deb" -O /tmp/checkmk-stable.deb
wget "https://download.checkmk.com/checkmk/2.1.0b8/check-mk-raw-2.1.0b8_0.focal_amd64.deb" -O /tmp/checkmk-beta.deb
apt-get install -y /tmp/checkmk-stable.deb
omd create --admin-password 'cmk' stable
apt-get install -y /tmp/checkmk-beta.deb
omd create --admin-password 'cmk' beta
omd status -b stable || omd start stable
omd status -b beta || omd start beta
SCRIPT
srv.vm.provision "shell", inline: $script
end

# Ubuntu
config.vm.define "ansible-collection", primary: true do |srv|
srv.vm.box = "ubuntu/focal64"
srv.vm.network "private_network", ip: "192.168.56.42"
srv.ssh.insert_key = false
srv.vm.provider "virtualbox" do |v|
v.name = 'ansible-collection'
v.memory = 4096
v.cpus = 2
end
$script = <<-SCRIPT
apt-get update
apt-get install -y python3-pip
pip install -r /vagrant/requirements.txt
ansible-galaxy collection install -f -r /vagrant/requirements.yml
wget "https://download.checkmk.com/checkmk/2.0.0p23/check-mk-raw-2.0.0p23_0.focal_amd64.deb" -O /tmp/checkmk-stable.deb
wget "https://download.checkmk.com/checkmk/2.1.0b8/check-mk-raw-2.1.0b5_0.focal_amd64.deb" -O /tmp/checkmk-beta.deb
wget "https://download.checkmk.com/checkmk/2.1.0p4/check-mk-raw-2.1.0p4_0.focal_amd64.deb" -O /tmp/checkmk-stable.deb
wget "https://download.checkmk.com/checkmk/2.1.0p4/check-mk-raw-2.1.0p4_0.focal_amd64.deb" -O /tmp/checkmk-beta.deb
apt-get install -y /tmp/checkmk-stable.deb
omd create --admin-password 'cmk' stable
apt-get install -y /tmp/checkmk-beta.deb
Expand Down
51 changes: 51 additions & 0 deletions changelogs/fragments/agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# https://docs.ansible.com/ansible/latest/community/development_process.html#changelogs-how-to
minor_changes:
- Enable agent role to automatically add hosts to Checkmk during agent installation.
- Enable firewall management of the host to allow instant access to the agent.

bugfixes:
- Handle hosts, where systemd version is below 220. It is now possible to automatically install xinetd in those cases. This has to be enabled explicitely.

# known_issues:
# - This release is still in development and a heavy work in progress.
# - Discovery module is not feature complete yet.
# - Downtime module is not fully idempotent yet. This affects service downtimes and deletions.

## Line Format
# When writing a changelog entry, use the following format:

# - scope - description starting with a lowercase letter and ending with a period at the very end. Multiple sentences are allowed (https://github.com/reference/to/an/issue or, if there is no issue, reference to a pull request itself).

# The scope is usually a module or plugin name or group of modules or plugins, for example, lookup plugins. While module names can (and should) be mentioned directly (foo_module), plugin names should always be followed by the type (foo inventory plugin).

# For changes that are not really scoped (for example, which affect a whole collection), use the following format:

# - Description starting with an uppercase letter and ending with a dot at the very end. Multiple sentences are allowed (https://github.com/reference/to/an/issue or, if there is no issue, reference to a pull request itself).


## Possible keys:

# breaking_changes

# Changes that break existing playbooks or roles. This includes any change to existing behavior that forces users to update tasks. Displayed in both the changelogs and the Porting Guides.
# major_changes

# Major changes to Ansible itself. Generally does not include module or plugin changes. Displayed in both the changelogs and the Porting Guides.
# minor_changes

# Minor changes to Ansible, modules, or plugins. This includes new features, new parameters added to modules, or behavior changes to existing parameters.
# deprecated_features

# Features that have been deprecated and are scheduled for removal in a future release. Displayed in both the changelogs and the Porting Guides.
# removed_features

# Features that were previously deprecated and are now removed. Displayed in both the changelogs and the Porting Guides.
# security_fixes

# Fixes that address CVEs or resolve security concerns. Include links to CVE information.
# bugfixes

# Fixes that resolve issues.
# known_issues

# Known issues that are currently not fixed or will not be fixed.
47 changes: 47 additions & 0 deletions changelogs/fragments/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# https://docs.ansible.com/ansible/latest/community/development_process.html#changelogs-how-to
minor_changes:
- Introduce ansible linting for roles and fix findings.

# known_issues:
# - This release is still in development and a heavy work in progress.
# - Discovery module is not feature complete yet.
# - Downtime module is not fully idempotent yet. This affects service downtimes and deletions.

## Line Format
# When writing a changelog entry, use the following format:

# - scope - description starting with a lowercase letter and ending with a period at the very end. Multiple sentences are allowed (https://github.com/reference/to/an/issue or, if there is no issue, reference to a pull request itself).

# The scope is usually a module or plugin name or group of modules or plugins, for example, lookup plugins. While module names can (and should) be mentioned directly (foo_module), plugin names should always be followed by the type (foo inventory plugin).

# For changes that are not really scoped (for example, which affect a whole collection), use the following format:

# - Description starting with an uppercase letter and ending with a dot at the very end. Multiple sentences are allowed (https://github.com/reference/to/an/issue or, if there is no issue, reference to a pull request itself).


## Possible keys:

# breaking_changes

# Changes that break existing playbooks or roles. This includes any change to existing behavior that forces users to update tasks. Displayed in both the changelogs and the Porting Guides.
# major_changes

# Major changes to Ansible itself. Generally does not include module or plugin changes. Displayed in both the changelogs and the Porting Guides.
# minor_changes

# Minor changes to Ansible, modules, or plugins. This includes new features, new parameters added to modules, or behavior changes to existing parameters.
# deprecated_features

# Features that have been deprecated and are scheduled for removal in a future release. Displayed in both the changelogs and the Porting Guides.
# removed_features

# Features that were previously deprecated and are now removed. Displayed in both the changelogs and the Porting Guides.
# security_fixes

# Fixes that address CVEs or resolve security concerns. Include links to CVE information.
# bugfixes

# Fixes that resolve issues.
# known_issues

# Known issues that are currently not fixed or will not be fixed.
Loading

0 comments on commit b9e133e

Please sign in to comment.