Zack Williams | 6dc2d45 | 2017-12-20 17:50:49 -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 | 22e8993 | 2016-03-15 11:08:06 -0700 | [diff] [blame] | 16 | # roles/dns-configure/tasks.yml |
| 17 | |
Zack Williams | ba5549c | 2017-03-25 15:04:45 -0700 | [diff] [blame] | 18 | - name: Make sure resolvconf is doing DNS resolver mangling |
| 19 | apt: |
| 20 | name: resolvconf |
| 21 | update_cache: yes |
| 22 | cache_valid_time: 3600 |
| 23 | |
| 24 | - name: Create resolvconf configuration files |
Zack Williams | c56ac64 | 2016-03-15 11:08:47 -0700 | [diff] [blame] | 25 | template: |
Zack Williams | ba5549c | 2017-03-25 15:04:45 -0700 | [diff] [blame] | 26 | src: "{{ item }}.j2" |
| 27 | dest: "/etc/resolvconf/resolv.conf.d/{{ item }}" |
| 28 | mode: 0644 |
| 29 | owner: root |
| 30 | group: root |
| 31 | with_items: |
| 32 | - base |
| 33 | - head |
| 34 | register: resolvconf_configured |
| 35 | |
| 36 | - name: Tell resolvconf to refresh /etc/resolv.conf file if changed |
| 37 | become: yes |
| 38 | command: resolvconf -u |
| 39 | when: resolvconf_configured.changed |
| 40 | tags: |
| 41 | - skip_ansible_lint # needs to run before the DNS check which happens next, so can't be a handler |
Zack Williams | 22e8993 | 2016-03-15 11:08:06 -0700 | [diff] [blame] | 42 | |
Zack Williams | 82c88e9 | 2016-08-08 13:54:20 -0700 | [diff] [blame] | 43 | - name: Check that VM's can be found in DNS |
| 44 | shell: "dig +short {{ item.name }}.{{ site_suffix }} | grep {{ item.ipv4_last_octet }}" |
Zack Williams | ba5549c | 2017-03-25 15:04:45 -0700 | [diff] [blame] | 45 | with_items: "{{ head_lxd_list }}" |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 46 | tags: |
| 47 | - skip_ansible_lint # purely a way to pass/fail config done so far. Ansible needs a "dns_query" module |
Zack Williams | 82c88e9 | 2016-08-08 13:54:20 -0700 | [diff] [blame] | 48 | |
Zack Williams | 6dc2d45 | 2017-12-20 17:50:49 -0700 | [diff] [blame] | 49 | - name: Check that aliases can be found in DNS |
| 50 | when: not use_maas |
| 51 | shell: "dig +short {{ item.1.name }}.{{ site_suffix }} | grep {{ item.1.dest }}" |
| 52 | with_subelements: |
| 53 | - "{{ nsd_zones }}" |
| 54 | - aliases |
| 55 | tags: |
| 56 | - skip_ansible_lint # purely a way to pass/fail config done so far. Ansible needs a "dns_query" module |
| 57 | |