---
# tasks file for check-mk-agent
-- name: install Debian packages for CheckMk agent
+- name: install Debian packages for Check_MK agent
tags:
- check_mk
- monitoring
- packages
stat: path=/etc/systemd/system/check_mk.socket
when: "ansible_distribution_major_version >= '8'"
+ check_mode: no
register: check_mk_socket_unit
- name: install systemd socket unit files
template: >
dest=/etc/systemd/system/check_mk.socket
group=root
- mode=644
+ mode=0644
owner=root
src=check_mk.socket.j2
- when: "check_mk_socket_unit is defined and check_mk_socket_unit.stat.exists == False and ansible_distribution_major_version >= '8'"
+ when: ansible_distribution_major_version >= '8' and check_mk_socket_unit.stat.exists == False
notify:
- reload systemd daemon
template: >
dest=/etc/systemd/system/check_mk@.service
group=root
- mode=644
+ mode=0644
owner=root
src=check_mk@.service.j2
- when: "check_mk_socket_unit is defined and check_mk_socket_unit.stat.exists == False and ansible_distribution_major_version >= '8'"
+ when: ansible_distribution_major_version >= '8' and check_mk_socket_unit.stat.exists == False
notify:
- reload systemd daemon
+- name: enable xinetd configuration
+ tags:
+ - check_mk
+ lineinfile: >
+ dest=/etc/xinetd.d/check_mk
+ group=root
+ mode=0644
+ owner=root
+ regexp="^[\s]*disable[\s]*="
+ state=absent
+ when: "ansible_distribution_major_version < '8'"
+ notify:
+ - restart "xinetd"
+
- meta: flush_handlers
tags:
- check_mk
- packages
- systemd
-- name: ensure "check_mk.socket" is enabled and running
+- name: ensure "check_mk.socket" is enabled and started
tags:
- check_mk
- monitoring
service: >
enabled=yes
name=check_mk.socket
- state=running
+ state=started
when: "ansible_distribution_major_version >= '8'"