use static rndc.key; set localhost as a dns-resolver

This commit is contained in:
Sergey Bubnov (omg) 2019-06-30 12:38:16 +04:00
parent aa46353af2
commit c2ac109686
4 changed files with 24 additions and 19 deletions

View File

@ -5,3 +5,8 @@
service:
name: "{{ bind_service }}"
state: restarted
- name: restart network
service:
name: network
state: restarted

View File

@ -57,28 +57,23 @@
register: reverse_hashes_ipv6
with_items: "{{ bind_zone_ipv6_networks }}"
- name: Generate rndc.key
shell: rndc-confgen -a -b 128 -c /etc/rndc.key -k rndc-key
register: key_generated
when: key_generated is not defined
- name: "grab rndc.key"
fetch:
dest: "./.tmp/"
src: "/etc/rndc.key"
flat: true
validate_checksum: false
when: key_generated is defined
- name: "put master rndc.key to slave"
copy:
src: "./.tmp/rndc.key"
dest: "/etc/rndc.key"
- name: put rndc.key
template:
src: rndc.key.j2
dest: /etc/rndc.key
owner: root
group: named
mode: 0640
force: yes
when: key_generated is defined
- name: purge resolv.conf from interface`s config
shell: find /etc/net/ifaces -name 'resolv.conf' -delete
changed_when: false
- name: set DNS resolver to the localhost
template:
src: resolv.conf
dest: /etc/net/ifaces/lo/resolv.conf
notify: restart network
- include_tasks: master.yml
when: bind_zone_master_server_ip in ansible_all_ipv4_addresses

View File

@ -0,0 +1 @@
nameserver 127.0.0.1

View File

@ -0,0 +1,4 @@
key "rndc-key" {
algorithm hmac-md5;
secret "{{bind.rndc_key}}";
};