additional adjustments for postgres snmp extend

This commit is contained in:
rene
2022-03-23 18:46:54 +01:00
parent 4b8f39ae7f
commit ac7dd7ee87
2 changed files with 19 additions and 2 deletions

View File

@@ -6,6 +6,22 @@
owner: "root"
group: "root"
when: postgres == true
register: postgres_script
- name: database | snmpd | modify script part 1
lineinfile:
path: "/etc/snmp/postgres"
regexp: "^\$cpg -u $DBuser --action dbstats | awk -F ' ' '$"
state: present
line: "$cpg --action dbstats | awk -F ' ' '"
when: postgres_script.rc == 0
- name: database | snmpd | modify script part 2
replace:
path: "/etc/snmp/postgres"
regexp: "\\:"
replace: ":"
when: postgres_script.rc == 0
- include_tasks: install_check_postgres.yml
when: postgres == true
@@ -30,7 +46,7 @@
lineinfile:
path: "/etc/snmp/snmpd.conf"
state: present
line: "extend postgres /etc/snmp/postgres"
line: "extend postgres /usr/bin/sudo -u postgres /etc/snmp/postgres"
insertafter: "# SECTION: Extends"
notify: restart_snmpd
when: postgres == true
@@ -39,7 +55,7 @@
lineinfile:
path: "/etc/snmp/snmpd.conf"
state: present
line: "extend postgres /etc/snmp/postgres"
line: "extend mysql /etc/snmp/mysql"
insertafter: "# SECTION: Extends"
notify: restart_snmpd
when: mysql == true

View File

@@ -1 +1,2 @@
Debian-snmp ALL = NOPASSWD: /etc/snmp/bind, /etc/snmp/fail2ban, /etc/snmp/docker-stats.sh, /etc/snmp/mailcow-dockerized-postfix
Debian-snmp ALL = (postgres) NOPASSWD: /etc/snmp/postgres