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