Hi All,

I'm tried to check up which interfaces isn't configured in Ubuntu20 to 
configure it.
So, first I check which interfaces are on the system. Then it will check if 
this device is UP or not. I want to retrieve which interface isn't UP and 
put it a value in it: like :

ens160: 0
ens162: 1

For that in the next role later, I can configure the interface, when 
value=1.

- name: check which interfaces exist
  shell: find /sys/class/net -type l -not -lname '*virtual*' -printf '%f\n'
  register: ifconfig_result

- name: check which interface is active
  shell: ifconfig -a "{{ item }}"|head -1|grep -v UP || /bin/true
  loop: "{{ ifconfig_result.stdout_lines }}"
  register: active

- name: debug
  debug:
    msg: "{{ item }}"
  loop: "{{ active.results }}"

I've seen with debug, two things: first one, both results are ok because 
/bin/true and secondly, the item is not the key.
For this reason I don't know if it is possible in this case to retrieve 
this info.
Perhaps, there's another easiest solution??????
As someone an idea?
Could someone enlighten me ;) ?

Thank in advance and best regards

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dd7a6545-1c12-429a-9e8e-097e38ec7695n%40googlegroups.com.

Reply via email to