Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2bb3163
DCD module: First try. Local tests look fine.
lgetwan Aug 22, 2025
cf73264
Sanity is a full-time job (as Bad Religion sang).
lgetwan Aug 22, 2025
ac90ecb
It's f**in Python 2.7 compatible, now. And it must be late Friday whi…
lgetwan Aug 22, 2025
2f9a39b
DCD module: Enable the integration test
lgetwan Aug 25, 2025
66f9ab2
DCD module: Enable the integration test
lgetwan Aug 25, 2025
bdbb1f6
DCD module: Enable the integration test
lgetwan Aug 25, 2025
ab0cac9
DCD module: Enable the integration test
lgetwan Aug 25, 2025
b91efc7
DCD module: Enable the integration test
lgetwan Aug 25, 2025
7e19e2e
DCD module: Enable the integration test
lgetwan Aug 25, 2025
3bd8ef3
DCD module: Enable the integration test
lgetwan Aug 25, 2025
1f2a307
Ansible devel does no longer support Python 3.11
lgetwan Aug 25, 2025
7338fae
Update dcd module documentation.
robin-checkmk Aug 29, 2025
0e60a47
Update Checkmk versions for tests.
robin-checkmk Aug 29, 2025
fb97955
Add basic demo playbook.
robin-checkmk Aug 29, 2025
0b1dfa0
DCD module: First try. Local tests look fine.
lgetwan Aug 22, 2025
9e054b0
Sanity is a full-time job (as Bad Religion sang).
lgetwan Aug 22, 2025
0acd7ce
It's f**in Python 2.7 compatible, now. And it must be late Friday whi…
lgetwan Aug 22, 2025
983651f
DCD module: Enable the integration test
lgetwan Aug 25, 2025
3f9e902
DCD module: Enable the integration test
lgetwan Aug 25, 2025
71d75da
DCD module: Enable the integration test
lgetwan Aug 25, 2025
6dfd5ca
DCD module: Enable the integration test
lgetwan Aug 25, 2025
d9129ac
DCD module: Enable the integration test
lgetwan Aug 25, 2025
ee48fcc
DCD module: Enable the integration test
lgetwan Aug 25, 2025
65df442
DCD module: Enable the integration test
lgetwan Aug 25, 2025
1d0e44c
Ansible devel does no longer support Python 3.11
lgetwan Aug 25, 2025
a3f3ab7
Update dcd module documentation.
robin-checkmk Aug 29, 2025
70e8778
Update Checkmk versions for tests.
robin-checkmk Aug 29, 2025
b37c80e
Add basic demo playbook.
robin-checkmk Aug 29, 2025
9b9d0bc
Merge branch 'feature/dcd_module' of github.com:Checkmk/ansible-colle…
lgetwan Oct 29, 2025
1b80726
Restrict source hosts now defaults to an empty list.
lgetwan Oct 29, 2025
43b0e48
DCD Endpoints didn't exist in 2.2.0 times.
lgetwan Oct 29, 2025
4bfb366
DCD Endpoints didn't exist in 2.2.0 times. again.
lgetwan Oct 29, 2025
c1b6d1f
DCD module: Enable the integration test
lgetwan Aug 25, 2025
d3edc10
DCD module: Enable the integration test
lgetwan Aug 25, 2025
c8ebf82
DCD module: Enable the integration test
lgetwan Aug 25, 2025
6b8fcf9
Restrict source hosts now defaults to an empty list.
lgetwan Oct 29, 2025
b1ce78f
DCD Endpoints didn't exist in 2.2.0 times.
lgetwan Oct 29, 2025
9937bbb
DCD Endpoints didn't exist in 2.2.0 times. again.
lgetwan Oct 29, 2025
4fab648
Merge branch 'feature/dcd_module' of github.com:Checkmk/ansible-colle…
lgetwan Oct 29, 2025
78978f5
messing with commits 01.
lgetwan Oct 29, 2025
b1f3cdd
messing with commits 02.
lgetwan Oct 29, 2025
14c1191
messing with commits 03.
lgetwan Oct 29, 2025
e4773f1
messing with commits 04.
lgetwan Oct 29, 2025
3b52d7d
Adjust Checkmk versions in integration tests.
lgetwan Oct 30, 2025
c2274c6
Add attribution.
robin-checkmk Oct 31, 2025
2b08fb1
Update integration test and demo variables.
robin-checkmk Oct 31, 2025
ef7dde1
Add changelog.
robin-checkmk Oct 31, 2025
906eac2
Bugfix interval.
robin-checkmk Oct 31, 2025
7bef052
Added the parameter matching_hosts.
lgetwan Nov 5, 2025
1d87384
Merge branch 'feature/dcd_module' of github.com:Checkmk/ansible-colle…
lgetwan Nov 5, 2025
3f5f7ca
BLACKENDgit add plugins/modules/dcd.py !
lgetwan Nov 5, 2025
4f302e5
Idempotency...
lgetwan Nov 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/labels-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ module:bakery:
module:contact_group:
- 'Component Name: contact_group'

module:dcd:
- 'Component Name: dcd'

module:discovery:
- 'Component Name: discovery'

Expand Down
5 changes: 5 additions & 0 deletions .github/labels-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ module:contact_group:
- changed-files:
- any-glob-to-any-file: 'plugins/modules/contact_group.py'

module:dcd:
- any:
- changed-files:
- any-glob-to-any-file: 'plugins/modules/dcd.py'

module:discovery:
- any:
- changed-files:
Expand Down
95 changes: 95 additions & 0 deletions .github/workflows/ans-int-test-dcd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# README:
# - When changing the module name, it needs to be changed in 'env:MODULE_NAME' and in 'on:pull_requests:path'!
#
# Resources:
# - Template for this file: https://github.com/ansible-collections/collection_template/blob/main/.github/workflows/ansible-test.yml
# - About Ansible integration tests: https://docs.ansible.com/ansible/latest/dev_guide/testing_integration.html

env:
NAMESPACE: checkmk
COLLECTION_NAME: general
MODULE_NAME: dcd

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

name: Ansible Integration Tests for DCD Module
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0'
pull_request:
branches:
- main
- devel
paths:
- 'plugins/modules/dcd.py'
push:
paths:
- '.github/workflows/ans-int-test-dcd.yaml'
- 'plugins/modules/dcd.py'
- 'tests/integration/files/includes/'
- 'tests/integration/targets/activation/'

jobs:

integration:
runs-on: ubuntu-24.04
name: Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}
strategy:
fail-fast: false
matrix:
ansible:
- stable-2.17
- stable-2.18
- stable-2.19
- devel
python:
- '3.11'
- '3.12'
exclude:
# Exclude unsupported sets.
- ansible: devel
python: '3.11'

services:
old_cme:
image: checkmk/check-mk-managed:2.3.0p38
ports:
- 5323:5000
env:
CMK_SITE_ID: "old_cme"
CMK_PASSWORD: "Sup3rSec4et!"
stable_cme:
image: checkmk/check-mk-managed:2.4.0p13
ports:
- 5324:5000
env:
CMK_SITE_ID: "stable_cme"
CMK_PASSWORD: "Sup3rSec4et!"

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

- name: "Install uv and set the python version."
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python }}
enable-cache: true
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/

- name: "Setup uv venv."
run: uv venv
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Install ansible-base (${{ matrix.ansible }})
run: uv pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Run integration test
run: uv run ansible-test integration ${{env.MODULE_NAME}} -v --color --continue-on-error --diff --python ${{ matrix.python }}
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
2 changes: 2 additions & 0 deletions changelogs/fragments/dcd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- DCD module - Add DCD module.
1 change: 1 addition & 0 deletions meta/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ action_groups:
- activation
- bakery
- contact_group
- dcd
- discovery
- downtime
- folder
Expand Down
129 changes: 129 additions & 0 deletions playbooks/demo/dcd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
---
- name: "Showcase dcd module."
hosts: test
strategy: linear
gather_facts: false
vars_files:
- ../vars/auth.yml # This vars file provides details about your site
- ../vars/folders.yml # This vars file contains the folders to manage
- ../vars/dcd.yml # This vars file contains the groups to manage
tasks:
# - name: "Gather Date and Time Facts on localhost."
# ansible.builtin.setup:
# gather_subset:
# - date_time
# delegate_to: localhost
# run_once: true # noqa run-once[task]

- name: "Create folders."
folder:
server_url: "{{ checkmk_var_server_url }}"
site: "{{ checkmk_var_site }}"
automation_user: "{{ checkmk_var_automation_user }}"
automation_secret: "{{ checkmk_var_automation_secret }}"
path: "{{ item.path }}"
name: "{{ item.name }}"
state: "present"
delegate_to: localhost
run_once: true # noqa run-once[task]
loop: "{{ checkmk_var_folders }}"

- name: "Create hosts."
host:
server_url: "{{ checkmk_var_server_url }}"
site: "{{ checkmk_var_site }}"
automation_user: "{{ checkmk_var_automation_user }}"
automation_secret: "{{ checkmk_var_automation_secret }}"
name: "{{ inventory_hostname }}"
folder: "{{ checkmk_var_folder_path }}"
attributes:
site: "{{ checkmk_var_site }}"
ipaddress: 127.0.0.1
state: "present"
delegate_to: localhost

- name: "Create DCD Configuration."
dcd:
server_url: "{{ checkmk_var_server_url }}"
site: "{{ checkmk_var_site }}"
automation_user: "{{ checkmk_var_automation_user }}"
automation_secret: "{{ checkmk_var_automation_secret }}"
dcd_config: "{{ item }}"
state: "present"
loop: "{{ checkmk_var_dcd }}"
run_once: true # noqa run-once[task]
delegate_to: localhost

- name: "Pause to review changes." # noqa name[unique]
ansible.builtin.pause:
prompt: |
"Feel free to review the changes in your Checkmk site: {{ checkmk_var_site }}."
"Press <Enter> to continue."
when: not checkmk_var_run_unattended | bool

- name: "Activate changes on site." # noqa name[unique]
activation:
server_url: "{{ checkmk_var_server_url }}"
site: "{{ checkmk_var_site }}"
automation_user: "{{ checkmk_var_automation_user }}"
automation_secret: "{{ checkmk_var_automation_secret }}"
force_foreign_changes: 'true'
sites:
- "{{ checkmk_var_site }}"
delegate_to: localhost
run_once: true # noqa run-once[task]

- name: "Delete DCD Configuration."
dcd:
server_url: "{{ checkmk_var_server_url }}"
site: "{{ checkmk_var_site }}"
automation_user: "{{ checkmk_var_automation_user }}"
automation_secret: "{{ checkmk_var_automation_secret }}"
dcd_config: "{{ item }}"
state: "absent"
loop: "{{ checkmk_var_dcd }}"
run_once: true # noqa run-once[task]
delegate_to: localhost

- name: "Delete Hosts."
host:
server_url: "{{ checkmk_var_server_url }}"
site: "{{ checkmk_var_site }}"
automation_user: "{{ checkmk_var_automation_user }}"
automation_secret: "{{ checkmk_var_automation_secret }}"
name: "{{ inventory_hostname }}"
folder: "{{ checkmk_var_folder_path }}"
state: "absent"
delegate_to: localhost

- name: "Delete folders."
folder:
server_url: "{{ checkmk_var_server_url }}"
site: "{{ checkmk_var_site }}"
automation_user: "{{ checkmk_var_automation_user }}"
automation_secret: "{{ checkmk_var_automation_secret }}"
path: "{{ item.path }}"
name: "{{ item.name }}"
state: "absent"
delegate_to: localhost
run_once: true # noqa run-once[task]
loop: "{{ checkmk_var_folders }}"

- name: "Pause to review changes." # noqa name[unique]
ansible.builtin.pause:
prompt: |
"Feel free to review the changes in your Checkmk site: {{ checkmk_var_site }}."
"Press <Enter> to continue."
when: not checkmk_var_run_unattended | bool

- name: "Activate changes on site." # noqa name[unique]
activation:
server_url: "{{ checkmk_var_server_url }}"
site: "{{ checkmk_var_site }}"
automation_user: "{{ checkmk_var_automation_user }}"
automation_secret: "{{ checkmk_var_automation_secret }}"
force_foreign_changes: 'true'
sites:
- "{{ checkmk_var_site }}"
delegate_to: localhost
run_once: true # noqa run-once[task]
20 changes: 20 additions & 0 deletions playbooks/vars/dcd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
checkmk_var_dcd:

- title: "vSphere"
dcd_id: "vsphere"
comment: "Main vSphere Connector"
# site: "mysite"
connector:
connector_type: "piggyback"
interval: 60
creation_rules:
- folder_path: "/"
delete_hosts: false
host_attributes:
tag_address_family: "no-ip"
tag_agent: "special-agents"
tag_piggyback: "piggyback"
tag_snmp_ds: "no-snmp"
discover_on_creation: true
restrict_source_hosts: "localhost"
Loading