commited current state (new functions, may not work by now)
This commit is contained in:
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
|
||||
Reference in New Issue
Block a user