I have the following script that works when vlan_ids (map) have values,
what would be the best approach to fix make it work ?
- name: Set Ethernet address for each interface as detected
lineinfile:
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item }}"
state: present
regexp: "^HWADDR=.*"
line: "HWADDR={{ vars['ansible_' ~ item]['macaddress'] }}"
with_items: "{{ network_interfaces_to_configure | difference(vlan_ids.keys()) }}"
when vlan_ids is empty i have the following error:
{"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute u'ansible_e'\n\nThe error appears to be in '/config/tasks/main.yml': line 399, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Set Ethernet address for each interface as detected\n ^ here\n"}