Zack Williams | 503aabf | 2017-10-24 09:59:35 -0700 | [diff] [blame] | 1 | --- |
Matteo Scandolo | 3896c47 | 2017-08-01 13:31:42 -0700 | [diff] [blame] | 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 | |
Zack Williams | 503aabf | 2017-10-24 09:59:35 -0700 | [diff] [blame] | 16 | # dns-nsd/tasks/main.yml |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 17 | |
Zack Williams | 503aabf | 2017-10-24 09:59:35 -0700 | [diff] [blame] | 18 | - name: Install nsd |
| 19 | apt: |
| 20 | name: "{{ item }}" |
| 21 | state: present |
| 22 | update_cache: yes |
| 23 | cache_valid_time: 3600 |
| 24 | with_items: |
| 25 | - nsd |
Zack Williams | 6dc2d45 | 2017-12-20 17:50:49 -0700 | [diff] [blame] | 26 | register: nsd_install |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 27 | |
Zack Williams | 6dc2d45 | 2017-12-20 17:50:49 -0700 | [diff] [blame] | 28 | - name: Stop nsd until configured |
| 29 | when: nsd_install.changed |
| 30 | service: |
| 31 | name: nsd |
| 32 | enabled: no |
| 33 | state: stopped |
| 34 | tags: |
| 35 | - skip_ansible_lint # need to down service before configured |
| 36 | |
| 37 | - name: Create nsd zones directory |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 38 | file: |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 39 | name: "{{ nsd_zonesdir }}" |
| 40 | state: directory |
| 41 | mode: 0755 |
| 42 | owner: root |
| 43 | group: "{{ nsd_group }}" |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 44 | |
| 45 | - name: Create nsd.conf from template |
| 46 | template: |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 47 | src: nsd.conf.j2 |
| 48 | dest: "{{ nsd_conf }}" |
| 49 | mode: 0644 |
| 50 | owner: root |
| 51 | group: "{{ nsd_group }}" |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 52 | notify: |
Zack Williams | bed0e74 | 2016-04-07 21:23:52 -0700 | [diff] [blame] | 53 | - restart-nsd |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 54 | |
Zack Williams | 6dc2d45 | 2017-12-20 17:50:49 -0700 | [diff] [blame] | 55 | - name: Create forward zonefiles from template |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 56 | template: |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 57 | src: zone.forward.j2 |
| 58 | dest: "{{ nsd_zonesdir }}/{{ item.name }}.forward" |
| 59 | mode: 0644 |
| 60 | owner: root |
| 61 | group: "{{ nsd_group }}" |
| 62 | with_items: "{{ nsd_zones }}" |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 63 | notify: |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 64 | - reload-nsd |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 65 | |
Zack Williams | 6dc2d45 | 2017-12-20 17:50:49 -0700 | [diff] [blame] | 66 | - name: Create reverse zonefiles from template |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 67 | template: |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 68 | src: zone.reverse.j2 |
| 69 | dest: "{{ nsd_zonesdir }}/{{ item.name }}.reverse" |
| 70 | mode: 0644 |
| 71 | owner: root |
| 72 | group: "{{ nsd_group }}" |
| 73 | with_items: "{{ nsd_zones }}" |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 74 | notify: |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 75 | - reload-nsd |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 76 | |
Zack Williams | 503aabf | 2017-10-24 09:59:35 -0700 | [diff] [blame] | 77 | - name: flush nsd handlers |
| 78 | meta: flush_handlers |
| 79 | |