Browse Source

add basic lxc_guest monitoring

python3
Andrea Cimbalo 7 years ago
parent
commit
95f93d6a5d
5 changed files with 39 additions and 1 deletions
  1. +1
    -1
      all.yaml
  2. +15
    -0
      roles/icinga2-monitoring/tasks/main.yaml
  3. +7
    -0
      roles/icinga2-monitoring/templates/host.conf.j2
  4. +10
    -0
      roles/icinga2/tasks/main.yaml
  5. +6
    -0
      roles/lxc_guest/tasks/main.yaml

+ 1
- 1
all.yaml View File

@ -1,10 +1,10 @@
- include: status.yaml
- include: ldap.yaml - include: ldap.yaml
- include: blogs.yaml - include: blogs.yaml
- include: lists.yaml - include: lists.yaml
- include: login.yaml - include: login.yaml
- include: mail.yaml - include: mail.yaml
- include: projects.yaml - include: projects.yaml
- include: status.yaml
- include: users.yaml - include: users.yaml
- include: webmail.yaml - include: webmail.yaml
- include: wiki.yaml - include: wiki.yaml

+ 15
- 0
roles/icinga2-monitoring/tasks/main.yaml View File

@ -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

+ 7
- 0
roles/icinga2-monitoring/templates/host.conf.j2 View File

@ -0,0 +1,7 @@
object Host "{{ item }}" {
import "generic-host"
vars.os = "Linux"
vars.address = "{{ hostvars | ip_from_inventory(item) }}"
vars.sla = "24x7"
}

+ 10
- 0
roles/icinga2/tasks/main.yaml View File

@ -90,3 +90,13 @@
owner: root owner: root
group: icingaweb2 group: icingaweb2
mode: 0640 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/

+ 6
- 0
roles/lxc_guest/tasks/main.yaml View File

@ -92,3 +92,9 @@
# - container_network # - container_network
# is changed by executing handlers now # is changed by executing handlers now
- meta: flush_handlers - meta: flush_handlers
- name: add monitoring facts
set_fact:
monitoring_host: "{{monitoring_host| default([]) }} + [ '{{ vm_name }}' ]"
delegate_facts: True
delegate_to: status

Loading…
Cancel
Save