From 0c578c6a7d38afbad879e58fb3ea703b6545e7ac Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 13 May 2018 16:11:02 -0500 Subject: [PATCH] debian-9 clear out interfaces when static ip --- roles/network/tasks/debian.yml | 7 +++++++ roles/network/templates/network/systemd.j2 | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/roles/network/tasks/debian.yml b/roles/network/tasks/debian.yml index 8830dcaa9..c5ffbadc9 100644 --- a/roles/network/tasks/debian.yml +++ b/roles/network/tasks/debian.yml @@ -49,6 +49,13 @@ src=network/debian-auto when: iiab_wan_iface != "none" and is_debian_9 +- name: Clearing out /etc/network/interfaces for static addresses (is_debian_9) + lineinfile: + state: absent + path: /etc/network/interfaces + regexp: "{{ iiab_wan_iface }}" + when: wan_ip != "dhcp" and iiab_wan_iface != "none" and is_debian_9 + - name: bind may be affected service: name={{ dns_service }} state=stopped when: named_install and dnsmasq_enabled diff --git a/roles/network/templates/network/systemd.j2 b/roles/network/templates/network/systemd.j2 index 9f9e143d6..9424d13e9 100644 --- a/roles/network/templates/network/systemd.j2 +++ b/roles/network/templates/network/systemd.j2 @@ -34,7 +34,7 @@ iface {{ iiab_wan_iface }} inet dhcp {% endif %} # end dhcp clients # static wan -{% if wan_ip != "dhcp" and dhcpcd_result != "enabled" and wan_in_interfaces == "false" %} +{% if wan_ip != "dhcp" and dhcpcd_result != "enabled" %} auto {{ iiab_wan_iface }} iface {{ iiab_wan_iface }} inet static address {{ wan_ip }}