Number of network interfaces varies in our environment and we have atleast
5 variants, hardcoding is not an option.
This playbook need to check {{ ansible_interfaces }} and then get the
status of all available interfaces active status.
from the example snippet below
"ansible_eth1": {
"active": true,
"device": "eth1",
I am trying to set_fact which should return the dict like
"eth1status_active" = "yes"
eth0status_active" = "no"
...
ethxstatus_active = 'xxx'
I have lost just before the last task
tasks:
- name: get filesystem
setup: gather_subset=network
- name: set fact network_interfaces
set_fact: network_interfaces={{ ansible_interfaces }}
- name: set fact
set_fact: iface_item="ansible_{{ item }}"
with_items: "{{ ansible_interfaces }}"
register: iface_result
- name: make a list
set_fact: iface_list="{{ iface_result.results |
map(attribute='ansible_facts.iface_item') | list }}"
Please help me continue playing ..
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/2d7e2d6a-7efa-4c11-afd9-ea5b941fc98b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.