]> arthur.barton.de Git - AnsibleRoles.git/blobdiff - roles/check-mk-agent/tasks/main.yml
Apt module: Update "state=installed" to "state=present"
[AnsibleRoles.git] / roles / check-mk-agent / tasks / main.yml
index d907b27e84e4623e5db076ddd35c19b76dbab69d..3e5ffc0b53195bca472e83aa14591e266d0fa464 100644 (file)
@@ -1,19 +1,28 @@
 ---
 # tasks file for check-mk-agent
 
-- name: install Debian packages for Check_MK agent
+- name: install Debian packages for Check_MK agent (1/2)
   tags:
     - check_mk
     - monitoring
     - packages
   apt: >
-    state=installed
+    state=present
     name={{ item }}
   with_items:
     - check-mk-agent
-    - check-mk-agent-logwatch
     - 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 >= '7' and ansible_distribution_major_version < '9'"
+
 - name: test for systemd unit files
   tags:
     - check_mk
@@ -21,6 +30,7 @@
     - 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
 
@@ -59,7 +69,7 @@
   lineinfile: >
     dest=/etc/xinetd.d/check_mk
     group=root
-    mode=644
+    mode=0644
     owner=root
     regexp="^[\s]*disable[\s]*="
     state=absent
     - 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'"