From a690343336c06f157899df13fc221e20eac2efae Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Thu, 24 Nov 2022 12:27:59 +0200 Subject: [PATCH] add nagios to docker if exists --- tasks/configure.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tasks/configure.yml b/tasks/configure.yml index 87ceb17..d22e97b 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -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 \ No newline at end of file + state: started