Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 1 | --- |
| 2 | #file: roles/dns-nsd/tasks/main.yml |
| 3 | |
Zack Williams | 6f5a6e7 | 2016-08-10 17:45:27 -0700 | [diff] [blame] | 4 | - name: Include OS specific vars |
| 5 | include_vars: "{{ ansible_os_family }}.yml" |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 6 | |
| 7 | # Debian specific installation |
| 8 | - include: nsd-Debian.yml |
| 9 | when: ansible_os_family == 'Debian' |
| 10 | |
| 11 | - name: Ensure that zones directory exists |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 12 | file: |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 13 | name={{ nsd_zonesdir }} |
| 14 | state=directory |
| 15 | mode=0755 owner=root group={{ nsd_group }} |
| 16 | |
| 17 | - name: Create nsd.conf from template |
| 18 | template: |
| 19 | src=nsd.conf.j2 |
| 20 | dest={{ nsd_conf }} |
| 21 | mode=0644 owner=root group={{ nsd_group }} |
| 22 | notify: |
Zack Williams | bed0e74 | 2016-04-07 21:23:52 -0700 | [diff] [blame] | 23 | - restart-nsd |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 24 | |
| 25 | - name: create forward zonefiles from template |
| 26 | template: |
| 27 | src=zone.forward.j2 |
| 28 | dest={{ nsd_zonesdir }}/{{ item.name }}.forward |
| 29 | mode=0644 owner=root group={{ nsd_group }} |
| 30 | with_items: '{{ nsd_zones }}' |
| 31 | notify: |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 32 | - reload-nsd |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 33 | |
| 34 | - name: create reverse zonefiles from template |
| 35 | template: |
| 36 | src=zone.reverse.j2 |
| 37 | dest={{ nsd_zonesdir }}/{{ item.name }}.reverse |
| 38 | mode=0644 owner=root group={{ nsd_group }} |
| 39 | with_items: '{{ nsd_zones }}' |
| 40 | notify: |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 41 | - reload-nsd |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 42 | |