Files
windows-ansible/ansible/playbooks/checkmk.yml
T
2024-05-20 13:33:30 +00:00

55 lines
1.6 KiB
YAML

---
- name: CheckMK Agent
hosts: "meta-win_project_{{ win_project }}"
collections:
- checkmk.general
vars_files:
- ../vars/checkmk.yml
- ../vars/common.yml
- ../vars/connection.yml
tasks:
- name: Install CheckMK agent on VMs
import_role:
name: agent
tags:
- checkmk
- checkmk_agent
- name: CheckMK Hosts
hosts: "meta-win_project_{{ win_project }}"
gather_facts: false
vars_files:
- ../vars/checkmk.yml
- ../vars/common.yml
tasks:
- name: Add Windows host into check
checkmk.general.host:
server_url: "{{ checkmk_agent_protocol }}://{{ checkmk_server }}:80/"
site: "{{ checkmk_agent_site }}"
validate_certs: "true"
automation_user: "{{ checkmk_agent_user }}"
automation_secret: "{{ checkmk_password }}"
folder: "/"
name: "{{ inventory_hostname }}"
attributes:
ipaddress: "{{ hostvars[inventory_hostname].ansible_host }}"
state: "{{ state }}"
delegate_to: "localhost"
notify: "activate changes"
tags:
- checkmk_host
- checkmk_all
- teardown
handlers:
- name: "Activate Changes"
listen: activate changes
checkmk.general.activation:
server_url: "{{ checkmk_agent_protocol }}://{{ checkmk_server }}:80/"
site: "{{ checkmk_agent_site }}"
automation_user: "{{ checkmk_agent_user }}"
automation_secret: "{{ checkmk_password }}"
force_foreign_changes: "false"
validate_certs: "true"
delegate_to: "localhost"
run_once: true