Skip to content

Commit 35c2faa

Browse files
committed
add postfix monitoring wrapper, allow for sudo configuration
1 parent 6e0f3d4 commit 35c2faa

4 files changed

Lines changed: 19 additions & 1 deletion

File tree

defaults/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ ncpa_packages:
1010

1111
ncpa_repo_package_url: https://repo.nagios.com/nagios/7/nagios-repo-7-4.el7.noarch.rpm
1212

13-
ncpa_community_string:
13+
ncpa_community_string:
14+
15+
ncpa_sudoers:
16+
- allowed_user: postfix
17+
allowed_command: /usr/lib64/nagios/plugins/check_postfix_mailqueue2.sh
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
sudo -u postfix /usr/lib64/nagios/plugins/check_postfix_mailqueue2.sh "$@"

tasks/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
mode: 0755
2828
with_fileglob: usr.lib64.nagios.plugins.*
2929

30+
- name: place sudoers file for relevant checks
31+
template:
32+
src: etc.sudoers.d.99-nagios.j2
33+
dest: "/etc/sudoers.d/99-nagios"
34+
owner: root
35+
group: root
36+
mode: '0640'
37+
when: ncpa_sudoers|length > 0
38+
3039
- name: ensure ncpa_listener is started and enabled
3140
service: name=ncpa_listener state=started enabled=yes
3241

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{% for sudo_lines in ncpa_sudoers %}
2+
nagios ALL=({{ sudo_lines.allowed_user }}) NOPASSWD:{{ sudo_lines.allowed_command }}
3+
{% endfor %}

0 commit comments

Comments
 (0)