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