Browse Source

roles/monitoring_agent: new role !

python3
Zolfa 4 years ago
parent
commit
e46dc3cde8
Signed by: zolfa GPG Key ID: E1A43B038C4D6616
2 changed files with 43 additions and 0 deletions
  1. +3
    -0
      roles/monitoring-agent/defaults/main.yaml
  2. +40
    -0
      roles/monitoring-agent/tasks/main.yaml

+ 3
- 0
roles/monitoring-agent/defaults/main.yaml View File

@ -0,0 +1,3 @@
---
host_fqdn: '{{ ansible_hostname }}.dmz.{{ domain }}'
...

+ 40
- 0
roles/monitoring-agent/tasks/main.yaml View File

@ -0,0 +1,40 @@
---
- name: 'install monitoring agent requirements'
apt:
pkg: 'monitoring-plugins-basic'
state: 'present'
update_cache: true
cache_valid_time: 3600
tags:
- 'packages'
- name: 'create monitoring user'
user:
name: 'icinga'
state: 'present'
tags:
- 'monitoring'
- name: 'create monitoring entry'
set_fact:
agent_monitoring_entry: >
{{ {
host_fqdn: {
'address': ansible_host,
'agent_type': 'ssh',
}
} }}
tags:
- 'monitoring'
- name: 'update monitoring facts'
set_fact:
monitoring_facts: >
{{ hostvars[monitoring_host]['monitoring_facts']
| default({})
| combine(agent_monitoring_entry, recursive=true) }}
delegate_facts: true
delegate_to: '{{ monitoring_host }}'
tags:
- 'monitoring'
...

Loading…
Cancel
Save