diff --git a/inventory/host_vars/lime2 b/inventory/host_vars/lime2 index 5d0a633..1124f18 100644 --- a/inventory/host_vars/lime2 +++ b/inventory/host_vars/lime2 @@ -184,6 +184,3 @@ nagstamon_pwd: !vault | 35333633613530373864373530653936376532663933346431376435356665373863356461393734 6435363230366562630a636364653531366563313335303464666337356138656634373063643431 33613664333030643233303738343930376263353038653762633461646330346436 - -smart_devices: - - /dev/mmcblk0 diff --git a/inventory/host_vars/lime2-test b/inventory/host_vars/lime2-test index f754506..1d944d6 100644 --- a/inventory/host_vars/lime2-test +++ b/inventory/host_vars/lime2-test @@ -1,6 +1,3 @@ --- ipv4_addr: 10.1.2.80 - -smart_devices: - - /dev/vda diff --git a/inventory/host_vars/mailserver-test b/inventory/host_vars/mailserver-test index 476dd5e..b8f4dbb 100644 --- a/inventory/host_vars/mailserver-test +++ b/inventory/host_vars/mailserver-test @@ -1,7 +1,3 @@ --- ipv4_addr: 10.1.2.25 - -smart_devices: - - /dev/vda - - /dev/vdb diff --git a/roles/icinga2_master/templates/zones.d/master/hosts.conf.j2 b/roles/icinga2_master/templates/zones.d/master/hosts.conf.j2 index 83d0b5f..58c5c48 100644 --- a/roles/icinga2_master/templates/zones.d/master/hosts.conf.j2 +++ b/roles/icinga2_master/templates/zones.d/master/hosts.conf.j2 @@ -3,19 +3,23 @@ object Host "{{ icinga2_master }}" { import "generic-host" address = "{{ hostvars[icinga2_master].ipv4_addr }}" +{% if hostvars[icinga2_master].smart_devices is defined %} {% for device in hostvars[icinga2_master].smart_devices %} vars.smart_devices["smart::{{ device }}"] = { smart_device = "{{ device }}" } {% endfor %} +{% endif %} } object Host "{{ icinga2_agent }}" { import "generic-host" address = "{{ hostvars[icinga2_agent].ipv4_addr }}" +{% if hostvars[icinga2_agent].smart_devices is defined %} {% for device in hostvars[icinga2_agent].smart_devices %} vars.smart_devices["smart::{{ device }}"] = { smart_device = "{{ device }}" } {% endfor %} +{% endif %} }