Browse Source

icinga2: Expose tags into Icinga2 host vars

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
Maximilian Wilhelm 3 years ago
parent
commit
f565743f97
1 changed files with 11 additions and 4 deletions
  1. 11 4
      icinga2/host.conf.tmpl

+ 11 - 4
icinga2/host.conf.tmpl

@@ -1,8 +1,9 @@
 #
 # {{ node_id }}
 #
-{%- set roles = node_config.get ('roles', []) %}
-{%- set sites = node_config.get ('sites', []) %}
+{%- set roles = node_config.get ('roles', [])|sort %}
+{%- set sites = node_config.get ('sites', [])|sort %}
+{%- set tags = node_config.get ('tags', [])|sort %}
 {%- set address = salt['ffho_net.get_primary_ip'] (node_config, 'v4').ip %}
 {%- set address6 = salt['ffho_net.get_primary_ip'] (node_config, 'v6').ip %}
 {%- set monitoring_config = node_config.get ('monitoring', {}) %}
@@ -37,17 +38,23 @@ object Host "{{ node_id }}" {
 	vars.os = "Linux"
 
 	vars.roles = [
-{%- for role in roles|sort %}
+{%- for role in roles %}
 		"{{ role }}",
 {%- endfor %}
 	]
 
 	vars.sites = [
-{%- for site in sites|sort %}
+{%- for site in sites %}
 		"{{ site }}",
 {%- endfor %}
 	]
 
+	vars.tags = [
+{%- for tag in tags %}
+		"{{ tag }}",
+{%- endfor %}
+	]
+
 {#- Bare-metal host #}
 {%- if node_config.get ('hardware', False) %}