From: Zack Cerza Date: Thu, 16 Jun 2016 23:34:07 +0000 (-0600) Subject: Improve network interface discovery X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6ef18dbe7c5a517cc3cd4e85c281b1260d7e0fc9;p=ceph-cm-ansible.git Improve network interface discovery Signed-off-by: Zack Cerza --- diff --git a/roles/testnode/tasks/resolvconf.yml b/roles/testnode/tasks/resolvconf.yml index caeab47f..c57ca57a 100644 --- a/roles/testnode/tasks/resolvconf.yml +++ b/roles/testnode/tasks/resolvconf.yml @@ -8,7 +8,7 @@ - name: Set interface set_fact: - interface: "{{ hostvars[inventory_hostname].interface|default('eth0') }}" + interface: "{{ ansible_default_ipv4.interface }}" - name: Check for presence of /etc/network/interfaces stat: @@ -41,7 +41,9 @@ - name: ifdown and ifup shell: "ifdown {{ interface }} && ifup {{ interface }}" # Even if bounce_interface is False, we need to work around a Xenial issue - # where removing resolvconf breaks DNS by removing /etc/resolv.conf. Bouncing + # where purging resolvconf breaks DNS by removing /etc/resolv.conf. Bouncing # the interface rebuilds it. + # The Ubuntu bug is: + # https://bugs.launchpad.net/ubuntu/+source/resolvconf/+bug/1593489 when: bounce_interface == "True" or (ansible_lsb.id|lower == 'ubuntu' and ansible_lsb.major_release|int >= 16)