From d17911391942edc448904c1cd6bbc9be13742984 Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Wed, 15 Mar 2023 17:23:25 +0000 Subject: [PATCH] Fix role as a result of ANSIBLE_INJECT_FACT_VARS=false ansible_ injection is now disabled by default in openstack-ansible so the network interface information is now accessed via ansible_facts['ifname'] rather than ansible_facts['ansible_ifname']. This patch also replaces the use of hostvars[inventory_hostname] with the more correct access via ansible_facts. Change-Id: Id2c59badb6767d62799ab51504444d935b68b4ce --- tasks/swift_calculate_addresses.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tasks/swift_calculate_addresses.yml b/tasks/swift_calculate_addresses.yml index c35945ed..729b71aa 100644 --- a/tasks/swift_calculate_addresses.yml +++ b/tasks/swift_calculate_addresses.yml @@ -34,7 +34,7 @@ # Get the swift storage bridge - name: Get swift storage bridge set_fact: - swift_storage_bridge: "{{ 'ansible_' + swift.storage_network | replace('-', '_') }}" + swift_storage_bridge: "{{ swift.storage_network | replace('-', '_') }}" when: - swift.storage_network is defined - swift_storage_address is not defined @@ -46,7 +46,7 @@ filter: "{{ swift_storage_bridge }}" when: - swift_storage_bridge is defined - - hostvars[inventory_hostname][swift_storage_bridge] is defined + - ansible_facts[swift_storage_bridge] is defined - swift_storage_address is not defined - name: Swift storage address not found @@ -55,15 +55,15 @@ when: - swift.storage_network is defined - swift_storage_bridge is defined - - hostvars[inventory_hostname][swift_storage_bridge] is not defined + - ansible_facts[swift_storage_bridge] is not defined - swift_storage_address is not defined - name: Get swift storage address (with storage_network) set_fact: - swift_storage_address: "{{ hostvars[inventory_hostname][swift_storage_bridge]['ipv4']['address'] }}" + swift_storage_address: "{{ ansible_facts[swift_storage_bridge]['ipv4']['address'] }}" when: - swift_storage_bridge is defined - - hostvars[inventory_hostname][swift_storage_bridge] is defined + - ansible_facts[swift_storage_bridge] is defined - swift_storage_address is not defined tags: - always @@ -97,7 +97,7 @@ - name: Get swift replication bridge set_fact: - swift_replication_bridge: "{{ 'ansible_' + swift.replication_network | replace('-', '_') }}" + swift_replication_bridge: "{{ swift.replication_network | replace('-', '_') }}" when: - swift.replication_network is defined - swift_replication_address is not defined @@ -109,7 +109,7 @@ filter: "{{ swift_replication_bridge }}" when: - swift_replication_bridge is defined - - hostvars[inventory_hostname][swift_replication_bridge] is defined + - ansible_facts[swift_replication_bridge] is defined - swift_replication_address is not defined - name: Swift replication address not found @@ -118,15 +118,15 @@ when: - swift.replication_network is defined - swift_replication_bridge is defined - - hostvars[inventory_hostname][swift_replication_bridge] is not defined + - ansible_facts[swift_replication_bridge] is not defined - swift_replication_address is not defined - name: Get swift replication address (with replication_network) set_fact: - swift_replication_address: "{{ hostvars[inventory_hostname][swift_replication_bridge]['ipv4']['address'] }}" + swift_replication_address: "{{ ansible_facts[swift_replication_bridge]['ipv4']['address'] }}" when: - swift_replication_bridge is defined - - hostvars[inventory_hostname][swift_replication_bridge] is defined + - ansible_facts[swift_replication_bridge] is defined - swift_replication_address is not defined tags: - always