From 711d1894631cfd427fc7e0746b22748e5509dd31 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 22 Jul 2022 03:13:37 +0200 Subject: [PATCH] Fix dnsmasq --- conf/dnsmasq-lxd | 2 ++ scripts/install | 3 +-- scripts/remove | 3 +++ scripts/restore | 3 +-- 4 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 conf/dnsmasq-lxd diff --git a/conf/dnsmasq-lxd b/conf/dnsmasq-lxd new file mode 100644 index 0000000..aa50cdd --- /dev/null +++ b/conf/dnsmasq-lxd @@ -0,0 +1,2 @@ +bind-interfaces +except-interface=__LXC_BRIDGE__ diff --git a/scripts/install b/scripts/install index 9ea0f5f..5640bde 100755 --- a/scripts/install +++ b/scripts/install @@ -187,8 +187,7 @@ then chmod 400 "$config_path/client.hcl" chown $app:$app "$config_path/client.hcl" - echo "bind-interfaces -except-interface=lxdbr0" > /etc/dnsmasq.d/lxd + ynh_add_config --template="../conf/dnsmasq-lxd" --destination="/etc/dnsmasq.d/lxd" systemctl restart dnsmasq ynh_add_config --template="../conf/default.conf" --destination="/etc/lxc/default.conf" diff --git a/scripts/remove b/scripts/remove index 648451f..80619b3 100755 --- a/scripts/remove +++ b/scripts/remove @@ -41,6 +41,7 @@ fi #================================================= ynh_script_progression --message="Stopping and removing the systemd service..." +nomad node drain -self -enable # Remove the dedicated systemd config ynh_remove_systemd_config @@ -96,6 +97,8 @@ then systemctl disable lxc-net --quiet ynh_secure_remove --file="/etc/default/lxc-net" ynh_secure_remove --file="/etc/lxc/default.conf" + ynh_secure_remove --file="/etc/dnsmasq.d/lxd" + systemctl restart dnsmasq fi #================================================= diff --git a/scripts/restore b/scripts/restore index 0cc003f..7423905 100755 --- a/scripts/restore +++ b/scripts/restore @@ -113,8 +113,7 @@ then main_iface=$(ip route | grep default | awk '{print $5;}') ynh_app_setting_set --app=$app --key=main_iface --value=$main_iface - echo "bind-interfaces -except-interface=lxdbr0" > /etc/dnsmasq.d/lxd + ynh_add_config --template="../conf/dnsmasq-lxd" --destination="/etc/dnsmasq.d/lxd" systemctl restart dnsmasq ynh_add_config --template="../conf/lxc-net" --destination="/etc/default/lxc-net"