12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #
- # {{ 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', {}) %}
- {%- 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 }}"
- 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 %}
- }
|