- name: "Nameserver: powerdns-server | snmpd | get script"
  get_url:
    url: "https://github.com/librenms/librenms-agent/raw/master/snmp/powerdns.py"
    dest: "/etc/snmp/powerdns.py"
    mode: "0755"
    owner: "root"
    group: "root"

- name: "Nameserver: powerdns-server | snmpd | remove bind script"
  file:
    path: "/etc/snmp/bind"
    state: absent

- name: "Nameserver: powerdns-server | snmpd | configure extend"
  lineinfile:
    path: "{{ snmpd_conf }}"
    state: present
    line: "extend powerdns {{ sudo }} /etc/snmp/powerdns.py"
    insertafter: "# SECTION: Extends"
  notify: restart_snmpd

- name: "Nameserver: powerdns-server | snmpd | remove bind extend"
  lineinfile:
    path: "{{ snmpd_conf }}"
    state: absent # not required. choices: absent;present. Whether the line should be there or not.
    line: "extend unbound {{ sudo }} /etc/snmp/bind"
  notify: restart_snmpd
