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 | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 13 | name: "{{ nsd_zonesdir }}" |
| 14 | state: directory |
| 15 | mode: 0755 |
| 16 | owner: root |
| 17 | group: "{{ nsd_group }}" |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 18 | |
| 19 | - name: Create nsd.conf from template |
| 20 | template: |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 21 | src: nsd.conf.j2 |
| 22 | dest: "{{ nsd_conf }}" |
| 23 | mode: 0644 |
| 24 | owner: root |
| 25 | group: "{{ nsd_group }}" |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 26 | notify: |
Zack Williams | bed0e74 | 2016-04-07 21:23:52 -0700 | [diff] [blame] | 27 | - restart-nsd |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 28 | |
| 29 | - name: create forward zonefiles from template |
| 30 | template: |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 31 | src: zone.forward.j2 |
| 32 | dest: "{{ nsd_zonesdir }}/{{ item.name }}.forward" |
| 33 | mode: 0644 |
| 34 | owner: root |
| 35 | group: "{{ nsd_group }}" |
| 36 | with_items: "{{ nsd_zones }}" |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 37 | notify: |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 38 | - reload-nsd |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 39 | |
| 40 | - name: create reverse zonefiles from template |
| 41 | template: |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 42 | src: zone.reverse.j2 |
| 43 | dest: "{{ nsd_zonesdir }}/{{ item.name }}.reverse" |
| 44 | mode: 0644 |
| 45 | owner: root |
| 46 | group: "{{ nsd_group }}" |
| 47 | with_items: "{{ nsd_zones }}" |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 48 | notify: |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 49 | - reload-nsd |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 50 | |