From c731f86294b3071e3ad1618b43e5850adfe4195d Mon Sep 17 00:00:00 2001 From: Edoardo Putti Date: Sat, 24 Jun 2017 13:01:08 +0200 Subject: [PATCH] use `vm_gateway` group vars in lxc_guest --- roles/lxc_guest/tasks/main.yaml | 2 +- roles/lxc_guest/templates/config.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/lxc_guest/tasks/main.yaml b/roles/lxc_guest/tasks/main.yaml index 858a8cf..056cfe4 100644 --- a/roles/lxc_guest/tasks/main.yaml +++ b/roles/lxc_guest/tasks/main.yaml @@ -71,7 +71,7 @@ - name: update container DNS configuration shell: lxc-attach -n {{ vm_name }} --clear-env -e -- bash -c "grep -Pz1 'domain lilik.it\nnameserver {{ vm_gateway }}' /etc/resolv.conf || echo -e 'domain lilik.it\nnameserver {{ vm_gateway }}' > /etc/resolv.conf" register: container_dns_configuration - changed_when: container_dns_configuration.stdout != "domain lilik.it\nnameserver {{ hostvars[ext_gateway].ansible_host }}\n\u0000" + changed_when: container_dns_configuration.stdout != "domain lilik.it\nnameserver {{ vm_gateway }}\n\u0000" - name: update container network configuration shell: lxc-attach -n {{ vm_name }} --clear-env -e -- bash -c "grep -F 'iface eth0 inet manual' /etc/network/interfaces || sed -i 's/iface eth0 inet dhcp/iface eth0 inet manual/' /etc/network/interfaces" diff --git a/roles/lxc_guest/templates/config.j2 b/roles/lxc_guest/templates/config.j2 index 6b2fc20..033770c 100644 --- a/roles/lxc_guest/templates/config.j2 +++ b/roles/lxc_guest/templates/config.j2 @@ -11,5 +11,5 @@ lxc.network.flags = up lxc.network.link = br0 lxc.network.name = eth0 lxc.network.ipv4 = {{ hostvars[vm_name]['ansible_host'] }}/24 -lxc.network.ipv4.gateway = {{ hostvars[ext_gateway]['ansible_host'] }} +lxc.network.ipv4.gateway = {{ vm_gateway }} lxc.start.auto = {% if auto_start %}1{% else %}0{% endif %}