Fix interfaces in boot_param_tasks
Ansible stores all interfaces with _ in facts. It's very easy to check by
running 'ansible -i inv all -m setup'. This patch adds replace - with _ to find
interface properly in facts.
Closes-Bug: #1786212
Resolves: rhbz#1614036
Change-Id: Id290143d8a41964806ca9c5be4d7103a3833cb37
(cherry picked from commit 6ab5112eb2
)
This commit is contained in:
parent
2ff3cc5bfe
commit
c68f853204
|
@ -51,8 +51,10 @@
|
|||
replace: 'BOOTPROTO=none'
|
||||
when:
|
||||
- item.path | regex_replace('(^.*ifcfg-)(.*)', '\\2') != "lo"
|
||||
# Ensure the interface information is available in the facts
|
||||
- hostvars[inventory_hostname]['ansible_' + item.path | regex_replace('(^.*ifcfg-)(.*)', '\\2') | replace('-', '_') ] is defined
|
||||
# This condition will list all the interfaces except the one with valid IP (which is Provisioning network at this stage)
|
||||
# Simpler Version - hostvars[inventory_hostname]['ansible_' + iface_name ]['ipv4'] is undefined
|
||||
- hostvars[inventory_hostname]['ansible_' + item.path | regex_replace('(^.*ifcfg-)(.*)', '\\2') ]['ipv4'] is undefined
|
||||
- hostvars[inventory_hostname]['ansible_' + item.path | regex_replace('(^.*ifcfg-)(.*)', '\\2') | replace('-', '_') ]['ipv4'] is undefined
|
||||
with_items:
|
||||
- "{{ ifcfg_files.files }}"
|
||||
|
|
Loading…
Reference in New Issue