diff --git a/all.yaml b/all.yaml index 649155e..2dfa7e5 100644 --- a/all.yaml +++ b/all.yaml @@ -1,10 +1,10 @@ +- include: status.yaml - include: ldap.yaml - include: blogs.yaml - include: lists.yaml - include: login.yaml - include: mail.yaml - include: projects.yaml -- include: status.yaml - include: users.yaml - include: webmail.yaml - include: wiki.yaml diff --git a/roles/icinga2-monitoring/tasks/main.yaml b/roles/icinga2-monitoring/tasks/main.yaml new file mode 100644 index 0000000..712d65c --- /dev/null +++ b/roles/icinga2-monitoring/tasks/main.yaml @@ -0,0 +1,15 @@ +- include_role: + name: service + vars: + service_name: icinga2 + +- debug: + var: monitoring_host + +- name: add host monitoring + template: + src: host.conf.j2 + dest: "/etc/icinga2/conf.d/hosts/{{ item }}.conf" + with_items: + - "{{ monitoring_host }}" + notify: reload icinga2 diff --git a/roles/icinga2-monitoring/templates/host.conf.j2 b/roles/icinga2-monitoring/templates/host.conf.j2 new file mode 100644 index 0000000..41f2144 --- /dev/null +++ b/roles/icinga2-monitoring/templates/host.conf.j2 @@ -0,0 +1,7 @@ +object Host "{{ item }}" { + import "generic-host" + + vars.os = "Linux" + vars.address = "{{ hostvars | ip_from_inventory(item) }}" + vars.sla = "24x7" +} diff --git a/roles/icinga2/tasks/main.yaml b/roles/icinga2/tasks/main.yaml index e5fab84..3a69f78 100644 --- a/roles/icinga2/tasks/main.yaml +++ b/roles/icinga2/tasks/main.yaml @@ -90,3 +90,13 @@ owner: root group: icingaweb2 mode: 0640 + +- name: create icinga2 hosts directory + file: + path: /home/git/{{ item }} + state: directory + owner: icinga2 + group: icinga2 + mode: 0770 + with_items: + - /etc/icinga2/conf.d/hosts/ diff --git a/roles/lxc_guest/tasks/main.yaml b/roles/lxc_guest/tasks/main.yaml index eeb87f3..2fe688f 100644 --- a/roles/lxc_guest/tasks/main.yaml +++ b/roles/lxc_guest/tasks/main.yaml @@ -92,3 +92,9 @@ # - container_network # is changed by executing handlers now - meta: flush_handlers + +- name: add monitoring facts + set_fact: + monitoring_host: "{{monitoring_host| default([]) }} + [ '{{ vm_name }}' ]" + delegate_facts: True + delegate_to: status