blob: 5ea041852782f0197b2cf1b13076a185906c7d03 [file] [log] [blame]
Zack Williams6dc2d452017-12-20 17:50:49 -07001---
Matteo Scandolo3896c472017-08-01 13:31:42 -07002# 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 Williams22e89932016-03-15 11:08:06 -070016# roles/dns-configure/tasks.yml
17
Zack Williamsba5549c2017-03-25 15:04:45 -070018- 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 Williamsc56ac642016-03-15 11:08:47 -070025 template:
Zack Williamsba5549c2017-03-25 15:04:45 -070026 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 Williams22e89932016-03-15 11:08:06 -070042
Zack Williams82c88e92016-08-08 13:54:20 -070043- name: Check that VM's can be found in DNS
44 shell: "dig +short {{ item.name }}.{{ site_suffix }} | grep {{ item.ipv4_last_octet }}"
Zack Williamsba5549c2017-03-25 15:04:45 -070045 with_items: "{{ head_lxd_list }}"
Zack Williams35624562016-08-28 17:12:26 -070046 tags:
47 - skip_ansible_lint # purely a way to pass/fail config done so far. Ansible needs a "dns_query" module
Zack Williams82c88e92016-08-08 13:54:20 -070048
Zack Williams6dc2d452017-12-20 17:50:49 -070049- 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