feat: Add sudo to NRPE commands
Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
parent
70fc71917c
commit
2ad3fb5ea0
3 changed files with 16 additions and 1 deletions
|
|
@ -18,6 +18,20 @@
|
|||
dest: /etc/nagios/nrpe_local.cfg
|
||||
mode: "0644"
|
||||
|
||||
- name: List sudo commands
|
||||
ansible.builtin.set_fact:
|
||||
nrpe_sudo_commands: "{{ nrpe_sudo_commands | default([]) + [item.line] }}"
|
||||
loop: "{{ nrpe_commands }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
when: '"sudo" in item and item.sudo is truthy'
|
||||
|
||||
- name: Setup sudoers
|
||||
community.general.sudoers:
|
||||
name: nagios_nrpe
|
||||
user: nagios
|
||||
commands: "{{ nrpe_sudo_commands | default([]) }}"
|
||||
|
||||
- name: Manage daemon settings
|
||||
ansible.builtin.template:
|
||||
src: nrpe/nagios-nrpe-server.j2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue