02-14-2023 10:07 AM - edited 02-14-2023 10:09 AM
Hello,
My host_vars file as follows.
--
loopbacks:
- { interface: loopback0, addr: 30.30.30.30, mask: 32, tag: 54321 }
- { interface: loopback1, addr: 10.200.200.22, mask: 32, tag: 54321 }
--
Tasks file as follows.
name: CONFIGURE INTERFACE IP ADDR
nxos_l3_interface:
name: "{{ item.interface }}"
ipv4: "{{ item.addr }}/{{ item.mask }}"
tag: "{{ item.tag }}"
I get error as tag not recognisable
02-14-2023 10:25 AM
I'm curious if, for whatever reason, the value is not being picked up as an integer. Per the `nxos_l3_interface` docs, this must be an integer value -- but it may be being passed as a string.
You can debug the variable type using the commands referenced in this URL: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_filters.html#discovering-the-data-type
q.
02-14-2023 11:01 AM
For what its worth, I'm willing to bet this is actually the issue.
Based on this page: https://stackoverflow.com/questions/28234430/ansible-integer-variables-in-yaml
You may be able to do something like `"{{ item.tag | int }}"` to make sure that the integer filter is applied to the corresponding value supplied from the variable.
q.
02-15-2023 08:34 PM
Found out Ansible NXOS module I was using was not supporting many features. Solved the problem by upgrading Ansible NXOS module to 4.0.1.
Thank you!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide