Browse Source

roles/lxc_guest: new monitoring format

python3
Zolfa 5 years ago
parent
commit
da6eec775c
Signed by: zolfa GPG Key ID: E1A43B038C4D6616
2 changed files with 17 additions and 5 deletions
  1. +1
    -0
      roles/lxc_guest/defaults/main.yaml
  2. +16
    -5
      roles/lxc_guest/tasks/main.yaml

+ 1
- 0
roles/lxc_guest/defaults/main.yaml View File

@ -4,4 +4,5 @@ container_state: 'started'
distro: 'buster'
vm_size: '5G'
vg_name: '{{ hostvars[ansible_lxc_host]["vg_name"] | default(ansible_lxc_host+"-vg") }}'
host_fqdn: '{{ inventory_hostname }}.dmz.{{ domain }}'
...

+ 16
- 5
roles/lxc_guest/tasks/main.yaml View File

@ -84,9 +84,20 @@
- meta: 'flush_handlers'
- name: 'add monitoring facts'
set_fact:
monitoring_host: '{{ monitoring_host | default([]) }} + [ "{{ vm_name }}" ]'
delegate_facts: true
delegate_to: 'status'
- name: 'MONITORING | add to monitored hosts'
block:
- name: 'MONITORING | add HOST/{{ host_fqdn }} to monitored hosts'
set_fact:
lxc_monitoring_entry: >
{{ { host_fqdn: { 'address': ansible_host } } }}
- name: 'MONITORING | update monitoring facts'
set_fact:
monitoring_facts: >
{{ hostvars[monitoring_host]['monitoring_facts']
| default({})
| combine(lxc_monitoring_entry) }}
delegate_facts: true
delegate_to: '{{ monitoring_host }}'
tags:
- 'monitoring'
...

Loading…
Cancel
Save