Commit 9de32aee authored by Matthew Smith's avatar Matthew Smith
Browse files

Initial commit

parents
---
- name: do the zones exist
command: pdnsutil list-all-zones
register: list_all_zones
- name: debug list_all_zones
debug:
var: list_all_zones
- name: remove zones set to absent
command: pdnsutil delete-zone {{ item.name }}
when:
- item.name in list_all_zones.stdout_lines
- item.state is defined and item.state == 'absent'
with_items: "{{ pdns_zones }}"
- name: create zone
command: pdnsutil create-zone {{ item.name }} {{ item.nameservers[0] }}
when:
- item.name not in list_all_zones.stdout_lines
- item.state is not defined or (item.state is defined and item.state == 'present')
with_items: "{{ pdns_zones }}"
# Remove everything because of a bug in pdnsutil which creates duplicates records if you add the same record multiple times
- name: remove record
command: pdnsutil delete-rrset {{ item.0.name }} {{ item.1.name }} {{ item.1.type }}
with_subelements:
- "{{ pdns_zones | selectattr('records', 'defined') | list }}"
- records
- name: add records
command: pdnsutil add-record {{ item.0.name }} {{ item.1.name }} {{ item.1.type }} "{{ item.1.content }}"
when: item.1.state is not defined or (item.1.state is defined and item.1.state == 'present')
with_subelements:
- "{{ pdns_zones | selectattr('records', 'defined') | list }}"
- records
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment