WIP changes for adding hosts to checkmk

This commit is contained in:
abrown38 committed 2024-12-04 15:50:33 +00:00
1 parent 001db69fe0
commit 41c8ecdddc
5 files changed
+77 -8

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
---
- name: Gather the package facts
ansible.builtin.package_facts:
manager: apt
- name: Setup CheckMK agent
block:
- name: Include CheckMK variables
ansible.builtin.include_vars:
file: ../vars/checkmk.yml
- name: Add proxy host into checkMK
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: "present"
notify: "activate changes"
- name: Install CheckMK Agent
import_role:
name: checkmk.general.agent
when: ansible_facts.packages['check-mk-agent'] | default('Missing') == 'Missing'
- name: register agent for TLS
shell: |
cmk-agent-ctl proxy-register --hostname {{ inventory_hostname }} --server {{ checkmk_server }} --site {{ checkmk_agent_site }} --user {{ checkmk_agent_user }} --password '{{ checkmk_password }}' --trust-cert
+6 -1
View File
@@ -69,4 +69,9 @@
state: started
enabled: true
when:
- not ansible_check_mode
- not ansible_check_mode
- name: Import checkmk.yml
import_tasks:
file: checkmk.yml
tags: proxy_cmk