forked from infra/ansible
icinga: move host config into zones in order to support agents
This commit is contained in:
parent
4715798c3f
commit
c2b8944756
@ -11,7 +11,7 @@
|
|||||||
- name: Regenerate hosts.conf
|
- name: Regenerate hosts.conf
|
||||||
assemble:
|
assemble:
|
||||||
src: /etc/icinga2/conf.d/hosts
|
src: /etc/icinga2/conf.d/hosts
|
||||||
dest: /etc/icinga2/conf.d/hosts.conf
|
dest: /etc/icinga2/zones.d/master/hosts.conf
|
||||||
# validate: /usr/sbin/icinga2 daemon -c %s --validate
|
# validate: /usr/sbin/icinga2 daemon -c %s --validate
|
||||||
notify: Restart icinga2
|
notify: Restart icinga2
|
||||||
delegate_to: "{{ icinga_server }}"
|
delegate_to: "{{ icinga_server }}"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
- name: Regenerate hosts.conf
|
- name: Regenerate hosts.conf
|
||||||
assemble:
|
assemble:
|
||||||
src: /etc/icinga2/conf.d/hosts
|
src: /etc/icinga2/conf.d/hosts
|
||||||
dest: /etc/icinga2/conf.d/hosts.conf
|
dest: /etc/icinga2/zones.d/master/hosts.conf
|
||||||
# validate: /usr/sbin/icinga2 daemon -c %s --validate
|
# validate: /usr/sbin/icinga2 daemon -c %s --validate
|
||||||
notify: Restart icinga2
|
notify: Restart icinga2
|
||||||
delegate_to: "{{ icinga_server }}"
|
delegate_to: "{{ icinga_server }}"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{% for disk in disks %}
|
{% for disk in disks %}
|
||||||
|
|
||||||
vars.disks["disk {{ disk }}"] = {
|
vars.disks[" {{ disk }}"] = {
|
||||||
disk_partitions = "{{ disk }}"
|
disk_partitions = "{{ disk }}"
|
||||||
disk_wfree = "10%"
|
|
||||||
disk_cfree = "5%"
|
disk_cfree = "5%"
|
||||||
|
disk_wfree = "10%"
|
||||||
}
|
}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -65,6 +65,17 @@
|
|||||||
# TODO setup as master node
|
# TODO setup as master node
|
||||||
# icinga2 node setup --master
|
# icinga2 node setup --master
|
||||||
|
|
||||||
|
- name: Ensure directory for zone config exists
|
||||||
|
file:
|
||||||
|
path: /etc/icinga2/zones.d/master
|
||||||
|
state: directory
|
||||||
|
owner: "{{ icinga_user }}"
|
||||||
|
group: "{{ icinga_group }}"
|
||||||
|
|
||||||
|
- name: Configure zones
|
||||||
|
template: src=icinga2/zones.conf.j2 dest=/etc/icinga2/zones.conf owner={{ icinga_user }} group={{ icinga_group }}
|
||||||
|
notify: Restart icinga2
|
||||||
|
|
||||||
- name: Ensure directory for host snippets exists
|
- name: Ensure directory for host snippets exists
|
||||||
file:
|
file:
|
||||||
path: /etc/icinga2/conf.d/hosts
|
path: /etc/icinga2/conf.d/hosts
|
||||||
|
28
roles/icinga/templates/icinga2/zones.conf.j2
Normal file
28
roles/icinga/templates/icinga2/zones.conf.j2
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
object Endpoint "{{ ansible_fqdn }}" {
|
||||||
|
}
|
||||||
|
|
||||||
|
object Zone "master" {
|
||||||
|
endpoints = [ "{{ ansible_fqdn }}" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
{% for host in groups['all'] %}
|
||||||
|
{% if host != ansible_fqdn %}
|
||||||
|
object Endpoint "{{ host }}" {
|
||||||
|
host = "{{ host }}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
object Zone "{{ host }}" {
|
||||||
|
endpoints = [ "{{ host }}" ]
|
||||||
|
parent = "master"
|
||||||
|
}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
object Zone "global-templates" {
|
||||||
|
global = true
|
||||||
|
}
|
||||||
|
|
||||||
|
object Zone "director-global" {
|
||||||
|
global = true
|
||||||
|
}
|
@ -64,7 +64,7 @@
|
|||||||
- name: Regenerate hosts.conf
|
- name: Regenerate hosts.conf
|
||||||
assemble:
|
assemble:
|
||||||
src: /etc/icinga2/conf.d/hosts
|
src: /etc/icinga2/conf.d/hosts
|
||||||
dest: /etc/icinga2/conf.d/hosts.conf
|
dest: /etc/icinga2/zones.d/master/hosts.conf
|
||||||
# validate: /usr/sbin/icinga2 daemon -c %s --validate
|
# validate: /usr/sbin/icinga2 daemon -c %s --validate
|
||||||
notify: Restart icinga2
|
notify: Restart icinga2
|
||||||
delegate_to: "{{ icinga_server }}"
|
delegate_to: "{{ icinga_server }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user