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 | 22e8993 | 2016-03-15 11:08:06 -0700 | [diff] [blame] | 17 | --- |
| 18 | # roles/dns-configure/tasks.yml |
| 19 | |
Zack Williams | ba5549c | 2017-03-25 15:04:45 -0700 | [diff] [blame] | 20 | - name: Make sure resolvconf is doing DNS resolver mangling |
| 21 | apt: |
| 22 | name: resolvconf |
| 23 | update_cache: yes |
| 24 | cache_valid_time: 3600 |
| 25 | |
| 26 | - name: Create resolvconf configuration files |
Zack Williams | c56ac64 | 2016-03-15 11:08:47 -0700 | [diff] [blame] | 27 | template: |
Zack Williams | ba5549c | 2017-03-25 15:04:45 -0700 | [diff] [blame] | 28 | src: "{{ item }}.j2" |
| 29 | dest: "/etc/resolvconf/resolv.conf.d/{{ item }}" |
| 30 | mode: 0644 |
| 31 | owner: root |
| 32 | group: root |
| 33 | with_items: |
| 34 | - base |
| 35 | - head |
| 36 | register: resolvconf_configured |
| 37 | |
| 38 | - name: Tell resolvconf to refresh /etc/resolv.conf file if changed |
| 39 | become: yes |
| 40 | command: resolvconf -u |
| 41 | when: resolvconf_configured.changed |
| 42 | tags: |
| 43 | - 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] | 44 | |
Zack Williams | 82c88e9 | 2016-08-08 13:54:20 -0700 | [diff] [blame] | 45 | - name: Check that VM's can be found in DNS |
| 46 | shell: "dig +short {{ item.name }}.{{ site_suffix }} | grep {{ item.ipv4_last_octet }}" |
Zack Williams | ba5549c | 2017-03-25 15:04:45 -0700 | [diff] [blame] | 47 | with_items: "{{ head_lxd_list }}" |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 48 | tags: |
| 49 | - 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] | 50 | |