From 15f45accd9eaa9252ff4dbfe864b3d3e1e0d0cb4 Mon Sep 17 00:00:00 2001 From: Edoardo Putti Date: Thu, 13 Oct 2016 18:49:57 +0200 Subject: [PATCH] add retrieval of resolv.conf file from container --- roles/lxc_guest/tasks/main.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/roles/lxc_guest/tasks/main.yaml b/roles/lxc_guest/tasks/main.yaml index bab7de5..9913e24 100644 --- a/roles/lxc_guest/tasks/main.yaml +++ b/roles/lxc_guest/tasks/main.yaml @@ -45,6 +45,15 @@ state: "{{ container_state }}" register: container_running_state +- name: Read container DNS configuration + container_file_read: + name: "{{ vm_name }}" + path: /etc/resolv.conf + register: vm_resolv_conf + +- debug: + var: vm_resolv_conf + - name: update container DNS configuration shell: lxc-attach -n {{ vm_name }} --clear-env -e -- bash -c "grep '^nameserver {{ hostvars[ext_gateway].ansible_host }}$' /etc/resolv.conf || echo 'nameserver {{ hostvars[ext_gateway].ansible_host }}' > /etc/resolv.conf" register: container_dns_configuration