ansible-base/roles/icinga2_server/tasks/postconfigure_icinga2.yml
2020-10-03 15:32:02 +02:00

90 lines
2.2 KiB
YAML

---
- name: Icinga2 post config file deployed
template:
src: 'conf.d/{{ item }}.j2'
dest: '/etc/icinga2/conf.d/{{ item }}'
owner: "{{ icinga2_server_user }}"
group: "{{ icinga2_server_group }}"
mode: 0644
loop:
- commands.conf
- groups.conf
- notifications.conf
- services.conf
- templates.conf
- users.conf
- timeperiods.conf
notify: restart icinga2
- name: Icinga2 custom commands deployed
template:
src: 'conf.d/command-custom.conf.j2'
dest: '/usr/share/icinga2/include/command-custom.conf'
owner: root
group: root
mode: 0644
notify: restart icinga2
- name: custom nagios plugins deployed
copy:
src: "{{ item }}"
dest: "{{ icinga2_server_nagios_plugins_location }}/{{ item }}"
owner: root
group: root
mode: 0755
loop:
- check_dane
- check_openvpn
- check_rdns
notify: restart icinga2
- name: Nagios SSH folder created
file:
path: "/home/{{ icinga2_server_user }}/.ssh"
state: directory
owner: "{{ icinga2_server_user }}"
group: "{{ icinga2_server_group }}"
mode: '0755'
- name: Private key to access supervised servers
copy:
dest: "/home/{{ icinga2_server_user }}/.ssh/id_rsa"
owner: "{{ icinga2_server_user }}"
group: "{{ icinga2_server_group }}"
mode: '0600'
content: "{{ icinga2_server_icinga_ssh_privkey }}"
no_log: True
- name: Public key to access supervised servers
copy:
dest: "/home/{{ icinga2_server_user }}/.ssh/id_rsa.pub"
owner: "{{ icinga2_server_user }}"
group: "{{ icinga2_server_group }}"
mode: '0644'
content: "{{ icinga2_server_icinga_ssh_pubkey + '\n' }}"
- name: Icinga2 config hosts folder created
file:
path: "/etc/icinga2/conf.d/hosts"
state: directory
owner: "{{ icinga2_server_user }}"
group: "{{ icinga2_server_group }}"
mode: '0755'
- name: Python DNS module server installed
package:
name: "python-dns"
state: present
- name: Python dnspython module server installed
package:
name: "python-dnspython"
state: present
- name: Icingaweb2 monitoring module folder permissions configured
file:
path: "/usr/share/icingaweb2/modules/monitoring"
state: directory
mode: '0755'