blob: 83c3a6f7040b446a8bb3e6781a694fe45c7f843b [file] [log] [blame]
Matteo Scandolo3896c472017-08-01 13:31:42 -07001
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 Williams22e89932016-03-15 11:08:06 -070017---
18# roles/dns-configure/tasks.yml
19
Zack Williamsba5549c2017-03-25 15:04:45 -070020- 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 Williamsc56ac642016-03-15 11:08:47 -070027 template:
Zack Williamsba5549c2017-03-25 15:04:45 -070028 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 Williams22e89932016-03-15 11:08:06 -070044
Zack Williams82c88e92016-08-08 13:54:20 -070045- name: Check that VM's can be found in DNS
46 shell: "dig +short {{ item.name }}.{{ site_suffix }} | grep {{ item.ipv4_last_octet }}"
Zack Williamsba5549c2017-03-25 15:04:45 -070047 with_items: "{{ head_lxd_list }}"
Zack Williams35624562016-08-28 17:12:26 -070048 tags:
49 - 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 -070050