1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #
- # {{ node_id }}
- #
- {%- set roles = node_config.get ('roles', []) %}
- {%- set sites = node_config.get ('sites', []) %}
- {%- set address = salt['ffho_net.get_loopback_ip'] (node_config, node_id, 'v4') %}
- {%- set address6 = salt['ffho_net.get_loopback_ip'] (node_config, node_id, 'v6') %}
- {%- set monitoring_config = node_config.get ('monitoring', {}) %}
- {%- set state = node_config.get ('state', 'operation') %}
- {%- if 'icinga2server' not in roles %}
- object Endpoint "{{ node_id }}" {
- host = "{{ node_id }}"
- }
- object Zone "{{ node_id }}" {
- endpoints = [ "{{ node_id }}" ]
- parent = "master"
- }
- {%- endif %}
- object Host "{{ node_id }}" {
- import "generic-host"
- display_name = "{{ node_id }}"
- address = "{{ address }}"
- address6 = "{{ address6 }}"
- {%- if state != 'operation' %}
- # This node has state {{ state }}, don't whine about anything here
- enable_notifications = false
- {%- endif %}
- vars.os = "Linux"
- vars.roles = [
- {%- for role in roles|sort %}
- "{{ role }}",
- {%- endfor %}
- ]
- vars.sites = [
- {%- for site in sites|sort %}
- "{{ site }}",
- {%- endfor %}
- ]
- {%- if 'service_param' in monitoring_config %}
- vars.service_param = {
- {%- for service, params in monitoring_config.get ('service_param').items ()|sort %}
- "{{ service }}" = {
- {%- for entry, value in params.items ()|sort %}
- "{{ entry }}" = "{{ value }}",
- {%- endfor %}
- },
- {%- endfor %}
- }
- {%- endif %}
- }
|