Matteo Scandolo | 3896c47 | 2017-08-01 13:31:42 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 17 | --- |
| 18 | #file: roles/dns-nsd/tasks/main.yml |
| 19 | |
Zack Williams | 6f5a6e7 | 2016-08-10 17:45:27 -0700 | [diff] [blame] | 20 | - name: Include OS specific vars |
| 21 | include_vars: "{{ ansible_os_family }}.yml" |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 22 | |
| 23 | # Debian specific installation |
| 24 | - include: nsd-Debian.yml |
| 25 | when: ansible_os_family == 'Debian' |
| 26 | |
| 27 | - name: Ensure that zones directory exists |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 28 | file: |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 29 | name: "{{ nsd_zonesdir }}" |
| 30 | state: directory |
| 31 | mode: 0755 |
| 32 | owner: root |
| 33 | group: "{{ nsd_group }}" |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 34 | |
| 35 | - name: Create nsd.conf from template |
| 36 | template: |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 37 | src: nsd.conf.j2 |
| 38 | dest: "{{ nsd_conf }}" |
| 39 | mode: 0644 |
| 40 | owner: root |
| 41 | group: "{{ nsd_group }}" |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 42 | notify: |
Zack Williams | bed0e74 | 2016-04-07 21:23:52 -0700 | [diff] [blame] | 43 | - restart-nsd |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 44 | |
| 45 | - name: create forward zonefiles from template |
| 46 | template: |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 47 | src: zone.forward.j2 |
| 48 | dest: "{{ nsd_zonesdir }}/{{ item.name }}.forward" |
| 49 | mode: 0644 |
| 50 | owner: root |
| 51 | group: "{{ nsd_group }}" |
| 52 | with_items: "{{ nsd_zones }}" |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 53 | notify: |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 54 | - reload-nsd |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 55 | |
| 56 | - name: create reverse zonefiles from template |
| 57 | template: |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 58 | src: zone.reverse.j2 |
| 59 | dest: "{{ nsd_zonesdir }}/{{ item.name }}.reverse" |
| 60 | mode: 0644 |
| 61 | owner: root |
| 62 | group: "{{ nsd_group }}" |
| 63 | with_items: "{{ nsd_zones }}" |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 64 | notify: |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 65 | - reload-nsd |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 66 | |