From 772b827a6909ff3795fb32dbb0650d2f29c04638 Mon Sep 17 00:00:00 2001 From: Brent Eagles Date: Wed, 6 Oct 2021 13:02:20 -0230 Subject: [PATCH] Don't try to set unbound address when already set The 'ip addr add' command will fail the deployment if the address has already been set. Change-Id: I25f04198c5cc219f8b8e23d7501bfbce62b35959 (cherry picked from commit bab1af2250eda7cfa053c8b7be66a5d67711c7f5) --- .../tripleo_unbound/tasks/collocated_bind.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tripleo_ansible/roles/tripleo_unbound/tasks/collocated_bind.yml b/tripleo_ansible/roles/tripleo_unbound/tasks/collocated_bind.yml index e7493d19b..cbeb8ed69 100644 --- a/tripleo_ansible/roles/tripleo_unbound/tasks/collocated_bind.yml +++ b/tripleo_ansible/roles/tripleo_unbound/tasks/collocated_bind.yml @@ -44,8 +44,16 @@ - (_public_api_interface.interface is defined) and (_public_api_interface.interface|length > 0) become: true block: + - name: Check if the address is already on the device. + shell: "ip -o addr show dev {{ _public_api_interface.interface }} | grep {{ tripleo_unbound_listen_interfaces[0] }}" + failed_when: false + register: + _current_addr_search + - name: Set the unbound additional IPv4 address on the required device. command: "ip addr add {{ tripleo_unbound_listen_interfaces[0] }}/32 dev {{ _public_api_interface.interface }}" + when: + _current_addr_search.rc == 1 - name: Add line to ifup-local to make sure unbound's listen IPv4 address is set on restart become: true @@ -62,8 +70,17 @@ - (_public_api_interface.interface is defined) and (_public_api_interface.interface|length > 0) become: true block: + - name: Check if the address is already on the device. + shell: "ip -o addr show dev {{ _public_api_interface.interface }} | grep {{ tripleo_unbound_listen_interfaces[0] }}" + failed_when: false + register: + _current_addr_search + - name: Set the unbound additional IPv6 address on the required device. command: "ip addr add {{ tripleo_unbound_listen_interfaces[0] }}/128 dev {{ _public_api_interface.interface }}" + when: + _current_addr_search.rc == 1 + - name: Add line to ifup-local to make sure unbound's listen IPv6 address is set on restart become: true