Да
то что выше и говорилось
Просто lower к строке можно применить. К сложному объекту не получится :)
FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'str object' has no attribute 'macaddress'. 'str object' has no attribute 'macaddress'\n\nThe error appears to be in
- name: set device name 1
set_fact:
device: "{{ ( ansible_interfaces | map('lower') | selectattr('macaddress', 'equalto', '00:16:3e:b1:bb:f6') ) }}"
Так мак увеличивает, но не факт что фактор на другом сервере будет в верхнем регистре
- name: set device name 3
set_fact:
device: "{{ ( ansible_interfaces | selectattr('macaddress', 'equalto', '00:16:3e:b1:bb:f6' | upper) )}}"