commited current state (new functions, may not work by now)

This commit is contained in:
Ansible Servercow
2025-10-08 09:32:02 +02:00
parent e5f83941b9
commit b21a80af07
54 changed files with 1381 additions and 74 deletions

View File

@@ -0,0 +1,20 @@
- name: "Activate Changes"
checkmk.general.activation:
server_url: "{{ checkmk_server_url }}"
site: "{{ checkmk_monitoring_site }}"
automation_user: "{{ checkmk_automation_user }}"
automation_secret: "{{ checkmk_automation_pass }}"
run_once: true
delegate_to: localhost
- name: "Sign and bake pending agent jobs"
checkmk.general.bakery:
server_url: "{{ checkmk_server_url }}"
site: "{{ checkmk_monitoring_site }}"
automation_user: "{{ checkmk_automation_user }}"
automation_secret: "{{ checkmk_automation_pass }}"
signature_key_id: 1
signature_key_passphrase: "{{ checkmk_agent_bakery_passphrase }}"
state: "baked_signed"
delegate_to: localhost
run_once: true

View File

@@ -0,0 +1,15 @@
- name: "Create new Host at CheckMK Server"
checkmk.general.host:
server_url: "{{ checkmk_server_url }}"
site: "{{ checkmk_monitoring_site }}"
automation_user: "{{ checkmk_automation_user }}"
automation_secret: "{{ checkmk_automation_pass }}"
name: "{{ checkmk_agent_host_name }}"
folder: "{{ checkmk_host_folder }}"
attributes:
ipv6address: "{{ ansible_host }}"
state: present
delegate_to: localhost
notify:
- Activate Changes
- Sign and bake pending agent jobs

View File

@@ -0,0 +1,28 @@
- name: "Delete Host at CheckMK Server"
checkmk.general.host:
server_url: "{{ checkmk_server_url }}"
site: "{{ checkmk_monitoring_site }}"
automation_user: "{{ checkmk_automation_user }}"
automation_secret: "{{ checkmk_automation_pass }}"
name: "{{ backupcow__hostname }}"
folder: "{{ checkmk_host_folder }}"
attributes:
ipaddress: "{{ bmx_ipv4_public }}"
state: absent
notify:
- Activate Changes
- Sign and bake pending agent jobs
- name: "Remove CheckMK Agent from Host"
ansible.builtin.apt:
name: "check-mk-agent"
state: absent
purge: true
when: ansible_facts['distribution'] == 'Ubuntu' or ansible_facts['distribution'] == 'Debian'
register: cmk_agent_removal
- name: "Purge CheckMK Agent Configuration from Host"
ansible.builtin.file:
name: "/var/lib/cmk-agent"
state: absent
when: cmk_agent_removal.changed

View File

@@ -0,0 +1,10 @@
- name: "Run CheckMK Discovery for Host"
checkmk.general.discovery:
server_url: "{{ checkmk_server_url }}"
site: "{{ checkmk_monitoring_site }}"
automation_user: "{{ checkmk_automation_user }}"
automation_secret: "{{ checkmk_automation_pass }}"
host_name: "{{ ansible_hostname }}"
state: "fix_all"
notify:
- Activate Changes

View File

@@ -0,0 +1,9 @@
- name: "Sign and bake pending agent jobs"
checkmk.general.bakery:
server_url: "{{ checkmk_server_url }}"
site: "{{ checkmk_monitoring_site }}"
automation_user: "{{ checkmk_automation_user }}"
automation_secret: "{{ checkmk_automation_pass }}"
signature_key_id: 1
signature_key_passphrase: "{{ checkmk_agent_bakery_passphrase }}"
state: "baked_signed"