From cd8de5c66d0b95eac36f42173e13c05e89dab742 Mon Sep 17 00:00:00 2001 From: Jimmy McCrory Date: Mon, 22 Oct 2018 16:57:24 -0700 Subject: [PATCH] Restart lxc-dnsmasq after clearing iptables rules When a functional test is run against the same host more than once and iptables rules are managed by lxc-dnsmasq the rules that lxc-dnsmasq created during the first run are removed, preventing containers from accessing external networks. Add a notify to restart the service and recreate the rules. Change-Id: Ia3b39c7f81d24de10fe23cb000b1253f4b3dcbfd --- test-prepare-host.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test-prepare-host.yml b/test-prepare-host.yml index c0147ee2..af7b9bdc 100644 --- a/test-prepare-host.yml +++ b/test-prepare-host.yml @@ -30,6 +30,7 @@ - name: Clear iptables rules shell: "{{ playbook_dir }}/iptables-clear.sh" + register: iptables_clear tags: - skip_ansible_lint @@ -235,3 +236,12 @@ - network_interfaces_rhel is changed - item.alias is defined with_items: "{{ bridges }}" + + - name: Trigger dnsmasq restart + command: /bin/true + changed_when: + - lxc_net_manage_iptables | bool + - iptables_clear is defined + - iptables_clear is changed + notify: + - Restart dnsmasq