initial commit

This commit is contained in:
nd 2017-10-07 02:51:39 +02:00
commit 536df4f7dd
5 changed files with 653 additions and 0 deletions

39
handlers/main.yml Normal file
View file

@ -0,0 +1,39 @@
- name: copy zone
copy:
src: "/etc/powerdns/tpl/{{ item.item }}"
dest: "/etc/powerdns/zones/db.{{ item.item }}"
remote_src: yes
with_items: "{{ zonefilestask.results }}"
loop_control:
label: "{{ item.item }}"
when: item.changed
- name: set zone serial
replace:
regexp: "##sequence##"
replace: "{{ ansible_date_time.epoch }}"
dest: "/etc/powerdns/zones/db.{{ item.item }}"
with_items: "{{ zonefilestask.results }}"
loop_control:
label: "{{ item.item }}"
when: item.changed
- name: restart powerdns
service: name=pdns state=restarted
register: powerdns_restarted
- name: reload changed zones
command: "pdns_control bind-reload-now {{ zonefilestask.results|selectattr('changed')|join(' ', attribute='item') }}"
when: not powerdns_restarted | default(False)
- name: purge cache
command: "pdns_control purge"
when: not powerdns_restarted | default(False)
- name: notify slaves
command: "pdns_control notify {{ item.item }}"
with_items: "{{ zonefilestask.results }}"
loop_control:
label: "{{ item.item }}"
when: item.changed