diff --git a/roles/icinga/files/icinga2/zones.d/master/services.conf b/roles/icinga/files/icinga2/zones.d/master/services.conf new file mode 100644 index 0000000..dce2778 --- /dev/null +++ b/roles/icinga/files/icinga2/zones.d/master/services.conf @@ -0,0 +1,21 @@ +apply Service "apt" { + import "generic-service" + + check_command = "apt" + + command_endpoint = host.vars.agent_endpoint + + assign where host.vars.agent_endpoint && host.vars.os == "Linux" +} + +apply Service "disk" for (disk => config in host.vars.disks) { + import "generic-service" + + check_command = "disk" + + command_endpoint = host.vars.agent_endpoint + + assign where host.vars.agent_endpoint + + vars += config +} diff --git a/roles/icinga/tasks/main.yml b/roles/icinga/tasks/main.yml index 15c1b91..5cf799c 100644 --- a/roles/icinga/tasks/main.yml +++ b/roles/icinga/tasks/main.yml @@ -72,6 +72,10 @@ owner: "{{ icinga_user }}" group: "{{ icinga_group }}" +- name: Configure services + copy: src=icinga2/zones.d/master/services.conf dest=/etc/icinga2/zones.d/master/services.conf owner={{ icinga_user }} group={{ icinga_group }} + notify: Restart icinga2 + - name: Configure zones template: src=icinga2/zones.conf.j2 dest=/etc/icinga2/zones.conf owner={{ icinga_user }} group={{ icinga_group }} notify: Restart icinga2