Files
windows-ansible/ansible/playbooks/checkmk.yml
T

64 lines
1.8 KiB
YAML

---
- name: CheckMK Agent
hosts: "meta-win_project_{{ win_project }}:&meta-os_windows"
gather_facts: false
collections:
- checkmk.general
vars_files:
- ../vars/checkmk.yml
- ../vars/common.yml
- ../vars/connection.yml
tasks:
- name: Install CheckMK agent on VMs
block:
- name: Gather Facts
setup:
tags:
- checkmk_all
- checkmk_agent
- name: Install CheckMK agent on VMs
import_role:
name: agent
tags:
- checkmk_all
- checkmk_agent
- name: CheckMK Hosts
hosts: "meta-win_project_{{ win_project }}:&meta-os_windows"
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