Skip to content

Commit

Permalink
Network discovery updates for newer ansible
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahbx committed Jan 10, 2024
1 parent 4aeab3f commit 1781e09
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions ansible-ipi-install/roles/network-discovery/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,21 @@
# Need to do this as the ansible facts per interface use the naming convention with _ and not -
- name: Set eligible interfaces list
set_fact:
ansible_eligible_interfaces: "{{ ansible_eligible_interfaces | default([]) + [item | replace('-','_')] }}"
ansible_eligible_interfaces: "{{ ansible_eligible_interfaces | default([]) + [ansible_facts[item | replace('-','_')]] }}"
with_items:
- "{{ ansible_interfaces }}"

# Remove vlaned interfaces from eligible list
- name: Removing vlaned interfaces
set_fact:
ansible_eligible_interfaces: "{{ ansible_eligible_interfaces | reject('search', '[.]') | list }}"

- name: Get the bm interface
set_fact:
pub_nic: "{{ item }}"
when: ansible_{{ item }}.macaddress is defined and ansible_{{ item}}.type == "ether" and ansible_{{ item }}.macaddress == bm_mac
pub_nic: "{{ item.device }}"
when: item.macaddress is defined and item.type == "ether" and item.macaddress == bm_mac
with_items:
- "{{ ansible_eligible_interfaces }}"

- name: Get the provisioning interface
set_fact:
prov_nic: "{{ item }}"
when: ansible_{{ item }}.macaddress is defined and ansible_{{ item }}.type == "ether" and ansible_{{ item }}.macaddress == prov_mac
prov_nic: "{{ item.device }}"
when: item.macaddress is defined and item.type == "ether" and item.macaddress == prov_mac
with_items:
- "{{ ansible_eligible_interfaces }}"

Expand Down

0 comments on commit 1781e09

Please sign in to comment.