61 lines
1.6 KiB
YAML
61 lines
1.6 KiB
YAML
- name: database | snmpd | get script
|
|
get_url:
|
|
url: "https://github.com/librenms/librenms-agent/raw/master/snmp/postgres"
|
|
dest: "/etc/snmp/postgres"
|
|
mode: "0755"
|
|
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
|
|
|
|
- name: database | snmpd | get script
|
|
get_url:
|
|
url: "https://github.com/librenms/librenms-agent/raw/master/snmp/mysql"
|
|
dest: "/etc/snmp/mysql"
|
|
mode: "0755"
|
|
owner: "root"
|
|
group: "root"
|
|
when: mysql == true
|
|
|
|
- name: database | snmpd | create configuration
|
|
template:
|
|
src: "mysql.cnf.j2"
|
|
dest: "/etc/snmp/mysql.cnf"
|
|
mode: "0644"
|
|
when: mysql == true
|
|
|
|
- name: database | snmpd | configure extend
|
|
lineinfile:
|
|
path: "/etc/snmp/snmpd.conf"
|
|
state: present
|
|
line: "extend postgres /usr/bin/sudo -u postgres /etc/snmp/postgres"
|
|
insertafter: "# SECTION: Extends"
|
|
notify: restart_snmpd
|
|
when: postgres == true
|
|
|
|
- name: database | snmpd | configure extend
|
|
lineinfile:
|
|
path: "/etc/snmp/snmpd.conf"
|
|
state: present
|
|
line: "extend mysql /etc/snmp/mysql"
|
|
insertafter: "# SECTION: Extends"
|
|
notify: restart_snmpd
|
|
when: mysql == true |