--- # tasks file for check-mk-agent - name: install Debian packages for Check_MK agent (1/2) tags: - check_mk - monitoring - packages apt: state: present name: [ 'check-mk-agent', 'nagios-plugins-basic', ] - name: install Debian packages for Check_MK agent (2/2) tags: - check_mk - monitoring - packages apt: > state=present name=check-mk-agent-logwatch when: "ansible_distribution_major_version|int >= 7 and ansible_distribution_major_version|int < 9" - name: test for systemd unit files tags: - check_mk - monitoring - packages stat: path=/etc/systemd/system/check_mk.socket when: "ansible_distribution_major_version|int >= 8" check_mode: no register: check_mk_socket_unit - name: install systemd socket unit files tags: - check_mk - packages - systemd template: > dest=/etc/systemd/system/check_mk.socket group=root mode=0644 owner=root src=check_mk.socket.j2 when: ansible_distribution_major_version|int >= 8 and check_mk_socket_unit.stat.exists == False notify: - reload systemd daemon - name: install systemd service unit files tags: - check_mk - packages - systemd template: > dest=/etc/systemd/system/check_mk@.service group=root mode=0644 owner=root src=check_mk@.service.j2 when: ansible_distribution_major_version|int >= 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|int < 8" notify: - restart "xinetd" - meta: flush_handlers tags: - check_mk - name: ensure "check_mk.socket" is enabled and started tags: - check_mk - monitoring service: > enabled=yes name=check_mk.socket state=started when: "ansible_distribution_major_version|int >= 8"