commited current state (new functions, may not work by now)
This commit is contained in:
20
roles/checkmk-monitoring/handlers/main.yaml
Normal file
20
roles/checkmk-monitoring/handlers/main.yaml
Normal 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
|
||||
15
roles/checkmk-monitoring/tasks/create-host.yaml
Normal file
15
roles/checkmk-monitoring/tasks/create-host.yaml
Normal 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
|
||||
28
roles/checkmk-monitoring/tasks/delete-host.yaml
Normal file
28
roles/checkmk-monitoring/tasks/delete-host.yaml
Normal 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
|
||||
10
roles/checkmk-monitoring/tasks/discover-host.yaml
Normal file
10
roles/checkmk-monitoring/tasks/discover-host.yaml
Normal 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
|
||||
9
roles/checkmk-monitoring/tasks/sign-bake-agents.yaml
Normal file
9
roles/checkmk-monitoring/tasks/sign-bake-agents.yaml
Normal 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"
|
||||
Reference in New Issue
Block a user