엔지니어링
Ansible Purge DNS 플레이북
warpmemory
2017. 12. 6. 18:30
Purge PDNS host
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | [dns:vars] ansible_connection=ssh ansible_ssh_user=root [pdns] 1.1.1.1 2.2.2.2 [pdns_test] 3.3.3.3 [recursor] 4.4.4.4 5.5.5.5 [dnsdist] 6.6.6.6 7.7.7.7 8.8.8.8 9.9.9.9 [pdns_group:children] pdns pdns_test [dns:children] pdns_group recursor dnsdist | cs |
Purge PDNS play-book(purge_pdns.yaml)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - name : purge dns hosts: "{{ section | default(dns) }}" gather_facts: no vars: ansible_python_interpreter : "python" ansible_ssh_common_args : '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' tasks: - name: pdns purge command: 'pdns_control purge {{ domain }}' when: "'pdns' in group_names or 'pdns_test' in group_names" - name: recursor purge command: 'rec_control wipe-cache {{ domain }}' when: "'recursor' in group_names" - name: dnsdist purge command: "{{ item }}" with_items: - 'dnsdist -c -e "getPool(\"\"):getCache():expungeByName(newDNSName(\"{{ domain }}\"))";' - 'pdns_control purge {{ domain }}' when: "'dnsdist' in group_names" | cs |
Purge PDNS run
1 | ansible-playbook -v purge_pdns.yaml --extra-vars "domain=DOMAIN section=dns" | cs |