11 Commits

7 changed files with 53 additions and 23 deletions

View File

@@ -1,3 +1,5 @@
# .ansible-lint │
warn_list: # or 'skip_list' to silence them completely
- '106' # Role name {} does not match ``^[a-z][a-z0-9_]+$`` pattern
warn_list: [] # or 'skip_list' to silence them completely
skip_list:
- '403'
- '106'

View File

@@ -14,6 +14,11 @@ cmk_rpm_agent: http://url-from-your-agent-bakery-in-checkmk.rpm
# Copy paste the link address for MSI (Windows) agent from CheckMK
cmk_msi_agent: http://url-from-your-agent-bakery-in-checkmk.msi
# Check_MK GPG Key
# Copy paste the link address from Signature Keys for Signing Agents page
cmk_gpg_key_id: 1
cmk_gpg_key_url: "{{ cmk_omd_protocol }}://{{ cmk_omd_host }}/{{ cmk_omd_site }}/check_mk/wato.py?key={{ cmk_gpg_key_id }}&mode=download_signature_key"
# Should be username of an automation user in checkmk
cmk_username: some-username

View File

@@ -15,7 +15,9 @@
port: 6556/tcp
state: enabled
permanent: yes
immediate: yes
- name: ensure firewall reloaded
command: firewall-cmd --reload
changed_when: false
- name: remove agent
file:
path: /tmp/check-mk-agent.rpm
state: absent

0
lint Normal file
View File

View File

@@ -6,7 +6,7 @@ driver:
platforms:
- name: rhel8
image: guisea/centos8-ansible:latest
#dockerfile: Centos8-Dockerfile
# dockerfile: Centos8-Dockerfile
privileged: True
volume_mounts:
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
@@ -28,4 +28,4 @@ lint: |
set -e
yamllint .
ansible-lint
flake8
flake8

View File

@@ -1,5 +1,32 @@
- name: Register with CheckMK Update Server
shell: |
cmk-update-agent register -H $(hostname -s) --user {{ cmk_username }} \
--secret {{ cmk_secret }}
changed_when: false
- block:
- name: Register with CheckMK Update Server
shell: |
cmk-update-agent register -H $(hostname -s) --user {{ cmk_username }} \
--secret {{ cmk_secret }}
changed_when: false
notify: remove agent
rescue:
- name: Gather facts of packages
package_facts:
manager: "auto"
- name: Ensure check_mk_agent installed (again)
command: /usr/bin/yum install --nogpgcheck -y /tmp/check-mk-agent.rpm
args:
warn: no
notify:
- restart xinetd
- ensure firewall open
when: "'check-mk-agent' not in ansible_facts.packages"
- name: Gather facts of packages (again)
package_facts:
manager: "auto"
- name: Register with CheckMK Update Server (retry)
shell: |
cmk-update-agent register -H $(hostname -s) --user {{ cmk_username }} \
--secret {{ cmk_secret }}
changed_when: false
when: "'check-mk-agent' in ansible_facts.packages"
notify: remove agent

View File

@@ -1,9 +1,9 @@
---
# Tasks for installation on RedHat Family
- name: Ensure xinetd installed
yum:
package:
name: xinetd
state: installed
state: present
notify: restart xinetd
- name: Gather facts of packages
@@ -18,19 +18,13 @@
dest: /tmp/check-mk-agent.rpm
- name: Ensure check_mk_agent installed
yum:
name: /tmp/check-mk-agent.rpm
state: installed
command: /usr/bin/yum install --nogpgcheck -y /tmp/check-mk-agent.rpm
args:
warn: no
notify:
- restart xinetd
- cmk fresh install
- ensure firewall open
- ensure firewall reloaded
- name: Remove agent Download
file:
path: /tmp/check-mk-agent.rpm
state: absent
when: "'check-mk-agent' not in ansible_facts.packages or cmk_force_install"
tags:
- check_mk_agent