I’m pretty new to ansible, so I’m learning as i go. I run the code below and it seem to work. However i get the following errors messages? Any one know why? Any one have suggestions on how i should re-write it properly?
I'm pretty new to ansible, so I'm learning as i go. I run the code below and it seem to work. However i get the
following errors messages? Any one know why? Any one have suggestions on how i should re-write it properly?
---------------------------------------------------------
----------- C O D E -------------------------------
- name: Removing Access list from Vlan 7
ios_config:
parents: "interface {{ item }}"
lines:
- no ip access-group 100 in
when: hostvars[inventory_hostname]["ansible_facts"]["net_interfaces"]["{{ item }}"] is defined
loop:
- "Vlan7"
- "Vlan12"
- "Vlan253"
- "Vlan254"
- "Vlan250"
- "Vlan2007"
- "Vlan2012"
- "Vlan2253"
- "Vlan2254"
- "Vlan2250"--------------------------Error---------------------------------------------------
[WARNING]: conditional statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found:
hostvars[inventory_hostname]["ansible_facts"]["net_interfaces"]["{{ item }}"] is defined[WARNING]: conditional statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found:
hostvars[inventory_hostname]["ansible_facts"]["net_interfaces"]["{{ item }}"] is defined
Hello Joe,
don't use curly braces in when:, it is automatically evaluated as Jinja.
hostvars[inventory_hostname]["ansible_facts"]["net_interfaces"][item] is defined
Regards
Racke
Thank you for your assistance Sir.