added DNS resolver option powerdns-recursor

This commit is contained in:
2024-07-22 14:51:30 +02:00
parent 11a60747ed
commit 0dc1871268
7 changed files with 86 additions and 12 deletions

View File

@@ -0,0 +1,27 @@
- name: "Nameserver: powerdns-recursor | snmpd | get script"
get_url:
url: "https://github.com/librenms/librenms-agent/raw/master/snmp/powerdns-recursor"
dest: "/etc/snmp/powerdns-recursor"
mode: "0755"
owner: "root"
group: "root"
- name: "Nameserver: powerdns-recursor | snmpd | remove unbound script"
file:
path: "/etc/snmp/unbound"
state: absent
- name: "Nameserver: powerdns-recursor | snmpd | configure extend"
lineinfile:
path: "{{ snmpd_conf }}"
state: present
line: "extend powerdns-recursor {{ sudo }} /etc/snmp/powerdns-recursor"
insertafter: "# SECTION: Extends"
notify: restart_snmpd
- name: "Nameserver: powerdns-recursor | snmpd | remove unbound 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/unbound"
notify: restart_snmpd

View File

@@ -1,4 +1,4 @@
- name: nameserver | snmpd | get script
- name: "Nameserver: unbound | snmpd | get script"
get_url:
url: "https://github.com/librenms/librenms-agent/raw/master/snmp/unbound"
dest: "/etc/snmp/unbound"
@@ -6,10 +6,22 @@
owner: "root"
group: "root"
- name: nameserver | snmpd | configure extend
- name: "Nameserver: unbound | snmpd | remove powerdns-recursor script"
file:
path: "/etc/snmp/powerdns-recursor"
state: absent
- name: "Nameserver: unbound | snmpd | configure extend"
lineinfile:
path: "{{ snmpd_conf }}"
state: present
line: "extend unbound {{ sudo }} /etc/snmp/unbound"
insertafter: "# SECTION: Extends"
notify: restart_snmpd
notify: restart_snmpd
- name: "Nameserver: unbound | snmpd | remove powerdns-recursor extend"
lineinfile:
path: "{{ snmpd_conf }}"
state: absent
line: "extend powerdns-recursor {{ sudo }} /etc/snmp/powerdns-recursor"
notify: restart_snmpd

View File

@@ -0,0 +1,25 @@
- name: nameserver | powerdns-recursor | install packages
package:
name: "{{ powerdns-recursor_package }}"
state: present
- name: nameserver | powerdns-recursor | copy config
template:
src: "powerdns-recursor_network.conf.j2"
dest: "/etc/powerdns/recursor.d/override.conf"
mode: "0644"
owner: "root"
group: "root"
validate: "pdns_recursor --config=check"
- name: nameserver | powerdns-recursor | disable unbound
service:
name: "unbound"
state: stopped
enabled: False
- name: nameserver | powerdns-recursor | enable service
service:
name: "powerdns-recursor"
state: started
enabled: True

View File

@@ -12,6 +12,12 @@
group: "root"
validate: "unbound-checkconf %s"
name: nameserver | unbound | disable service pdns-resolver
service:
name: "powerdns-resolver"
state: stopped
enabled: False
- name: nameserver | unbound | enable service
service:
name: "unbound"

View File

@@ -6,21 +6,21 @@
- block:
- include_tasks: install_unbound.yml
- include_tasks: configure_unbound_snmpd.yml
when: unbound == true
when: unbound == true and powerdns_recursor != true
- name: nameserver | unbound | disable systemd-resolved
include_tasks: disable-systemd-resolved.yml
when: bind == true or unbound == true or powerdns == true
when: bind == true or unbound == true or powerdns_recursor == true
- block:
- include_tasks: install_bind.yml
- include_tasks: configure_bind_snmpd.yml
when: bind == true
when: bind == true and powerdns_auth != true
- block:
- include_tasks: install_powerdns.yml
- include_tasks: configure_powerdns_snmpd.yml
when: powerdns == true
- include_tasks: install_powerdns_recursor.yml
- include_tasks: configure_powerdns_recursor_snmpd.yml
when: powerdns_recursor == true and unbound != true
rescue:
- set_fact: task_failed=true