icinga: create host entries for all hosts known to ansible

This commit is contained in:
Markus 2021-05-14 13:32:45 +02:00
parent 1aebd59435
commit e0a5d012ee
2 changed files with 16 additions and 0 deletions

View File

@ -61,6 +61,10 @@
changed_when: "'for these changes to take effect' in features_result.stdout"
notify: Restart icinga2
- name: Configure known hosts for icinga
template: src=icinga2/conf.d/hosts.conf.j2 dest=/etc/icinga2/conf.d/hosts.conf owner={{ icinga_user }} group={{ icinga_group }}
notify: Restart icinga2
- name: Create group icingaweb2
group: name=icingaweb2 system=yes

View File

@ -0,0 +1,12 @@
{% for host in groups['all'] %}
object Host "{{ host }}" {
/* Import the default host template defined in `templates.conf`. */
import "generic-host"
/* Specify the address attributes for checks e.g. `ssh` or `http`. */
address = "{{ host }}"
/* Set custom variable `os` for hostgroup assignment in `groups.conf`. */
vars.os = "Linux"
}
{% endfor %}