add nagios to docker if exists

This commit is contained in:
Antonio J. Delgado 2022-11-24 12:27:59 +02:00
parent 28089bcd39
commit a690343336

View file

@ -1,13 +1,15 @@
---
# - name: Ensure Nagios is configured
# template:
# dest: /etc/nagios4/nagios.cfg
# src: templates/nagios.cfg.j2
# owner: "{{ nagios_user }}"
# group: "{{ nagios_group }}"
# mode: 0660
# backup: yes
# notify: Restart Nagios4
- name: Check if docker group exists
shell: grep docker /etc/groups
register: docker_group
- name: Add nagios to docker group if it exists
user:
name: nagios
append: true
groups:
- docker
when: docker_group.rc == 0
- name: Ensure folder for Nagios configurations exists
file:
@ -134,4 +136,4 @@
systemd:
name: nagios4
enabled: yes
state: started
state: started