icinga: create host entries for all hosts known to ansible
This commit is contained in:
parent
1aebd59435
commit
e0a5d012ee
@ -61,6 +61,10 @@
|
|||||||
changed_when: "'for these changes to take effect' in features_result.stdout"
|
changed_when: "'for these changes to take effect' in features_result.stdout"
|
||||||
notify: Restart icinga2
|
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
|
- name: Create group icingaweb2
|
||||||
group: name=icingaweb2 system=yes
|
group: name=icingaweb2 system=yes
|
||||||
|
|
||||||
|
12
roles/icinga/templates/icinga2/conf.d/hosts.conf.j2
Normal file
12
roles/icinga/templates/icinga2/conf.d/hosts.conf.j2
Normal 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 %}
|
Loading…
Reference in New Issue
Block a user