diff --git a/group_vars/all b/group_vars/all index a47a9a4..604b77a 100644 --- a/group_vars/all +++ b/group_vars/all @@ -1 +1,2 @@ -snmpd_conf: /etc/snmp/snmpd.conf \ No newline at end of file +snmpd_conf: /etc/snmp/snmpd.conf +sudo: {{ sudo }} \ No newline at end of file diff --git a/roles/database/tasks/configure_snmpd.yml b/roles/database/tasks/configure_snmpd.yml index a260fba..5c1ccbb 100644 --- a/roles/database/tasks/configure_snmpd.yml +++ b/roles/database/tasks/configure_snmpd.yml @@ -46,7 +46,7 @@ lineinfile: path: "{{ snmpd_conf }}" state: present - line: "extend postgres /usr/bin/sudo -u postgres /etc/snmp/postgres" + line: "extend postgres {{ sudo }} -u postgres /etc/snmp/postgres" insertafter: "# SECTION: Extends" notify: restart_snmpd when: postgres == true diff --git a/roles/nameserver/tasks/configure_unbound_snmpd.yml b/roles/nameserver/tasks/configure_unbound_snmpd.yml index cbb0dbc..85e2a64 100644 --- a/roles/nameserver/tasks/configure_unbound_snmpd.yml +++ b/roles/nameserver/tasks/configure_unbound_snmpd.yml @@ -10,6 +10,6 @@ lineinfile: path: "{{ snmpd_conf }}" state: present - line: "extend unbound /usr/bin/sudo /etc/snmp/unbound" + line: "extend unbound {{ sudo }} /etc/snmp/unbound" insertafter: "# SECTION: Extends" notify: restart_snmpd \ No newline at end of file diff --git a/roles/server/tasks/utilities/snmpd.yml b/roles/server/tasks/utilities/snmpd.yml index d6d5058..d2c420d 100644 --- a/roles/server/tasks/utilities/snmpd.yml +++ b/roles/server/tasks/utilities/snmpd.yml @@ -76,8 +76,8 @@ line: "extend {{ item.service }} '{{ item.script }}'" insertafter: "# SECTION: custom settings" loop: - - { service: "distro", script: "/usr/bin/sudo /etc/snmp/distro" } - - { service: "osupdate", script: "/usr/bin/sudo /etc/snmp/osupdate"} + - { service: "distro", script: "{{ sudo }} /etc/snmp/distro" } + - { service: "osupdate", script: "{{ sudo }} /etc/snmp/osupdate" } - { service: "hardware", script: "/bin/cat /sys/devices/virtual/dmi/id/product_name" } - { service: "manufacturer", script: "/bin/cat /sys/devices/virtual/dmi/id/sys_vendor" } - { service: "serial", script: "/bin/cat /sys/devices/virtual/dmi/id/product_serial" }