Skip to content

Commit

Permalink
Merge branch 'devel' of github.com:Checkmk/ansible-collection-checkmk…
Browse files Browse the repository at this point in the history
….general into feature/module-inventory
  • Loading branch information
robin-checkmk committed Sep 25, 2024
2 parents 96c24a4 + 08debeb commit b6afd7e
Show file tree
Hide file tree
Showing 36 changed files with 195 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ exclude_paths:
# requirements, like avoiding python identifiers. To disable add `var-naming`
# to skip_list.
# var_naming_pattern: "^[a-z_][a-z0-9_]*$"
var_naming_pattern: "^checkmk_(server|agent|var)_.*$"
var_naming_pattern: "^(__)?checkmk_(server|agent|var)_.*$"

use_default_rules: true
# Load custom rules from this specific folder
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cla.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
- name: 'CLA Assistant'
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA or my organization already has a signed CLA.') || github.event_name == 'pull_request_target'
uses: contributor-assistant/github-action@v2.5.1
uses: contributor-assistant/github-action@v2.5.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# the below token should have repo scope and must be manually added by you in the repository's secret
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
run: antsibull-docs collection --use-current --squash-hierarchy --fail-on-error --dest-dir ./docs/ ${{env.NAMESPACE}}.${{env.COLLECTION_NAME}}

- name: "Create Pull Request for Docs and Changelog against devel branch"
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
commit-message: Update Docs and Changelogs upon Release
signoff: false
Expand Down
19 changes: 12 additions & 7 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
* @robin-checkmk
/tests/ @robin-checkmk
/roles/ @robin-checkmk
/playbooks/ @robin-checkmk
/plugins/inventory/ @Max-checkmk
/plugins/lookup/version.py @lgetwan
*.md @robin-checkmk
/plugins/ @lgetwan
/plugins/doc_fragments/ @robin-checkmk
/plugins/lookup/ @lgetwan
/plugins/lookup/bakery.py @Max-checkmk
/plugins/module_utils/ @lgetwan
/plugins/modules/ @lgetwan
/plugins/module_utils/ @godspeed-you
/plugins/modules/user.py @lgetwan
/plugins/modules/bakery.py @Max-checkmk
/plugins/modules/contact_group.py @msekania
/plugins/modules/discovery.py @Max-checkmk
/plugins/modules/host_group.py @msekania
/plugins/modules/tag_group.py @Max-checkmk
/plugins/modules/timeperiod.py @Max-checkmk
/plugins/modules/password.py @Max-checkmk
/plugins/modules/service_group.py @msekania
/roles/agent/tasks/Windows.yml @Max-checkmk
/roles/agent/vars/Windows.yml @Max-checkmk
/roles/agent/tasks/Win32NT.yml @Max-checkmk
139 changes: 100 additions & 39 deletions playbooks/demo/lookup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,31 @@
msg: "Version is {{ checkmk_var_version }}"
vars:
checkmk_var_version: "{{ lookup('checkmk.general.version',
checkmk_var_server_url + '/' + checkmk_var_site,
validate_certs=False,
server_url=checkmk_var_server_url,
site=checkmk_var_site,
automation_user=checkmk_var_automation_user,
automation_secret=checkmk_var_automation_secret)
automation_secret=checkmk_var_automation_secret,
validate_certs=False)
}}"
delegate_to: localhost
run_once: true # noqa run-once[task]

- name: "Get the attributes of the main folder."
ansible.builtin.debug:
msg: "Attributes of main folder: {{ checkmk_var_attributes }}"
vars:
checkmk_var_attributes: "{{
lookup('checkmk.general.folder',
'~',
server_url=checkmk_var_server_url,
site=checkmk_var_site,
automation_user=checkmk_var_automation_user,
automation_secret=checkmk_var_automation_secret,
validate_certs=False)
}}"
delegate_to: localhost
run_once: true # noqa run-once[task]

- name: "Get all subfolders of the main folder recursively"
ansible.builtin.debug:
msg: "Folder tree: {{ item.id }}"
Expand All @@ -40,41 +57,85 @@
delegate_to: localhost
run_once: true # noqa run-once[task]

## TODO: @lgetwan: Please take a look at these tasks and fix them. Bonus: Add the new lookup modules. :)
- name: "Get all hosts of the main directory recursively."
ansible.builtin.debug:
msg: "Host found in {{ item.0.id }}: {{ item.1.title }}"
vars:
checkmk_var_looping: "{{
lookup('checkmk.general.folders',
'~',
show_hosts=True,
recursive=True,
server_url=checkmk_var_server_url,
site=checkmk_var_site,
automation_user=checkmk_var_automation_user,
automation_secret=checkmk_var_automation_secret,
validate_certs=False)
}}"
loop: "{{ checkmk_var_looping | subelements('members.hosts.value') }}"
loop_control:
label: "{{ item.0.id }}"
delegate_to: localhost
run_once: true # noqa run-once[task]

## TODO: @lgetwan: Please take a look at these tasks and beautify/fix them. Bonus: Add the new lookup modules. :)

# - name: "Get all Checkmk Sites."
# ansible.builtin.debug:
# msg: "Sites found: {{ checkmk_var_sites }}"
# vars:
# checkmk_var_sites: "{{ lookup('checkmk.general.sites',
# server_url=checkmk_var_server_url,
# site=checkmk_var_site,
# automation_user=checkmk_var_automation_user,
# automation_secret=checkmk_var_automation_secret,
# validate_certs=False)
# }}"
# delegate_to: localhost
# run_once: true # noqa run-once[task]

# - name: "Get all hosts of the folder /test recursively"
# ansible.builtin.debug:
# msg: "Host found in {{ item.0.id }}: {{ item.1.title }}"
# vars:
# checkmk_var_looping: "{{
# lookup('checkmk.general.folders',
# '~tests',
# show_hosts=True,
# recursive=True,
# server_url=checkmk_var_server_url,
# site=checkmk_var_site,
# automation_user=checkmk_var_automation_user,
# automation_secret=checkmk_var_automation_secret,
# validate_certs=False)
# }}"
# loop: "{{ checkmk_var_looping | subelements('members.hosts.value') }}"
# loop_control:
# label: "{{ item.0.id }}"
# delegate_to: localhost
# run_once: true # noqa run-once[task]
# - name: "Get a single site."
# ansible.builtin.debug:
# msg: "Site: {{ checkmk_var_looping }}"
# vars:
# checkmk_var_looping: "{{
# lookup('checkmk.general.site',
# 'mysite',
# show_hosts=True,
# recursive=True,
# server_url=checkmk_var_server_url,
# site=checkmk_var_site,
# automation_user=checkmk_var_automation_user,
# automation_secret=checkmk_var_automation_secret,
# validate_certs=False)
# }}"
# delegate_to: localhost
# run_once: true # noqa run-once[task]

# - name: "Get the attributes of folder /tests"
# ansible.builtin.debug:
# msg: "Attributes of folder /network: {{ checkmk_var_attributes }}"
# vars:
# checkmk_var_attributes: "{{
# lookup('checkmk.general.folder',
# '~tests',
# server_url=checkmk_var_server_url,
# site=checkmk_var_site,
# automation_user=checkmk_var_automation_user,
# automation_secret=checkmk_var_automation_secret,
# validate_certs=False)
# }}"
# delegate_to: localhost
# run_once: true # noqa run-once[task]
# - name: "Get all sites recursively."
# ansible.builtin.debug:
# msg: "Site ID {{ item.0.id }}: {{ item.1.title }}"
# vars:
# checkmk_var_sites: "{{ lookup('checkmk.general.sites',
# server_url=checkmk_var_server_url,
# site=checkmk_var_site,
# automation_user=checkmk_var_automation_user,
# automation_secret=checkmk_var_automation_secret,
# validate_certs=False)
# }}"
# checkmk_var_looping: "{{
# lookup('checkmk.general.site',
# item.0.id,
# show_hosts=True,
# recursive=True,
# server_url=checkmk_var_server_url,
# site=checkmk_var_site,
# automation_user=checkmk_var_automation_user,
# automation_secret=checkmk_var_automation_secret,
# validate_certs=False)
# }}"
# loop: "{{ checkmk_var_sites }}"
# loop_control:
# label: "{{ item.0.id }}"
# delegate_to: localhost
# run_once: true # noqa run-once[task]
2 changes: 1 addition & 1 deletion roles/agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Please make sure it is installed on your system and available for Ansible.

## Role Variables

checkmk_agent_version: "2.3.0p13"
checkmk_agent_version: "2.3.0p16"

The Checkmk version of the site your agents will talk to.

Expand Down
2 changes: 1 addition & 1 deletion roles/agent/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
checkmk_agent_version: "2.3.0p13"
checkmk_agent_version: "2.3.0p16"
checkmk_agent_edition: 'cre'
checkmk_agent_server_protocol: 'http'
checkmk_agent_server: 'localhost'
Expand Down
2 changes: 1 addition & 1 deletion roles/agent/molecule/2.2.0/group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# General
checkmk_var_version: "2.2.0p32"
checkmk_var_version: "2.2.0p33"
checkmk_var_edition: "cre"
checkmk_var_checkmk_site: "mysite"
checkmk_var_automation_user: "cmkadmin"
Expand Down
2 changes: 1 addition & 1 deletion roles/agent/molecule/2.3.0/group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# General
checkmk_var_version: "2.3.0p13"
checkmk_var_version: "2.3.0p16"
checkmk_var_edition: "cre"
checkmk_var_checkmk_site: "mysite"
checkmk_var_automation_user: "cmkadmin"
Expand Down
2 changes: 1 addition & 1 deletion roles/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To learn about the distributions used in automated tests, inspect the correspond

## Role Variables

checkmk_server_version: "2.3.0p13"
checkmk_server_version: "2.3.0p16"

The global Checkmk version. This is used for installing Checkmk.
To manage sites and their version, see `checkmk_server_sites`.
Expand Down
2 changes: 1 addition & 1 deletion roles/server/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ checkmk_server_server_stable_os:
- Ubuntu-22
- Ubuntu-24

checkmk_server_version: "2.3.0p13"
checkmk_server_version: "2.3.0p16"
checkmk_server_edition: 'cre'
checkmk_server_verify_setup: 'true'

Expand Down
2 changes: 1 addition & 1 deletion roles/server/molecule/2.2.0/group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# General
checkmk_var_version: "2.2.0p32"
checkmk_var_version: "2.2.0p33"
checkmk_var_edition: "cre"
checkmk_server_verify_setup: 'true'
checkmk_var_server_url: "http://127.0.0.1/"
Expand Down
2 changes: 1 addition & 1 deletion roles/server/molecule/2.3.0/group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# General
checkmk_var_version: "2.3.0p13"
checkmk_var_version: "2.3.0p16"
checkmk_var_edition: "cre"
checkmk_server_verify_setup: 'true'
checkmk_var_server_url: "http://127.0.0.1/"
Expand Down
4 changes: 2 additions & 2 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ collection_dir="${script_dir%/*}"

# Update these as necessary:
checkmk_ancient="2.1.0p47"
checkmk_oldstable="2.2.0p32"
checkmk_stable="2.3.0p13"
checkmk_oldstable="2.2.0p34"
checkmk_stable="2.3.0p17"

while getopts 's:t:' OPTION; do
case "$OPTION" in
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/targets/activation/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
test_sites:
- version: "2.3.0p13"
- version: "2.3.0p16"
edition: "cre"
site: "stable_cre"
- version: "2.3.0p13"
- version: "2.3.0p16"
edition: "cee"
site: "stable_cee"
- version: "2.2.0p32"
- version: "2.2.0p33"
edition: "cre"
site: "old_cre"
# - version: "2.1.0p47"
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/targets/bakery/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
test_sites:
- version: "2.3.0p13"
- version: "2.3.0p16"
edition: "cee"
site: "stable_cee"
- version: "2.2.0p32"
- version: "2.2.0p33"
edition: "cee"
site: "old_cee"
# - version: "2.1.0p47"
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/targets/contact_group/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
test_sites:
- version: "2.3.0p13"
- version: "2.3.0p16"
edition: "cme"
site: "stable_cme"
- version: "2.3.0p13"
- version: "2.3.0p16"
edition: "cee"
site: "stable_cee"
- version: "2.3.0p13"
- version: "2.3.0p16"
edition: "cre"
site: "stable_cre"
- version: "2.2.0p32"
- version: "2.2.0p33"
edition: "cre"
site: "old_cre"
# - version: "2.1.0p47"
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/targets/discovery/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
test_sites:
- version: "2.3.0p13"
- version: "2.3.0p16"
edition: "cee"
site: "stable_cee"
- version: "2.3.0p13"
- version: "2.3.0p16"
edition: "cre"
site: "stable_cre"
- version: "2.2.0p32"
- version: "2.2.0p33"
edition: "cre"
site: "old_cre"
# - version: "2.1.0p47"
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/targets/downtime/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
test_sites:
- version: "2.3.0p13"
- version: "2.3.0p16"
edition: "cee"
site: "stable_cee"
- version: "2.3.0p13"
- version: "2.3.0p16"
edition: "cre"
site: "stable_cre"
- version: "2.2.0p32"
- version: "2.2.0p33"
edition: "cre"
site: "old_cre"
# - version: "2.1.0p47"
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/targets/folder/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
test_sites:
- version: "2.3.0p13"
- version: "2.3.0p16"
edition: "cee"
site: "stable_cee"
- version: "2.3.0p13"
- version: "2.3.0p16"
edition: "cre"
site: "stable_cre"
- version: "2.2.0p32"
- version: "2.2.0p33"
edition: "cre"
site: "old_cre"
# - version: "2.1.0p47"
Expand Down
Loading

0 comments on commit b6afd7e

Please sign in to comment.