Forum Discussion
forsan_102218
Nov 06, 2018Nimbostratus
Ansible bigip_device_facts - Filter Output
Hi,
I'm new to ansible and have installed ansible version 2.7 and I'm trying to understand how I can filter the output from the new bigip_device_facts module as bigip_facts are depreciated.
I ha...
- Nov 08, 2018
The result from bigip_device_facts contains a list of dictionaries. It can be processed in a number of ways depending on the output you want, but here's a simple example how to print the output with debug:
- bigip_device_facts: provider: "{{ provider_vars }}" gather_subset: - vlans register: gathered_facts - name: "Debug vlans" debug: msg: "VLAN {{ item.name }} has tag {{ item.tag }}" with_items: "{{ gathered_facts.vlans }}"
jmartinez_38641
Mar 19, 2019Nimbostratus
Hi all,
I came here with the same doubt. the answer given is good and works perfectly, but if the gather_subset item contains a special character, it doesn't work.
This produces an error:
- bigip_device_facts:
provider: "{{ provider_vars }}"
gather_subset:
- ltm-pools
register: gathered_facts
- name: "Debug vlans"
debug:
msg: "VLAN {{ item.name }} has tag {{ item.tag }}"
with_items: "{{ gathered_facts.ltm-pools }}"
Output error:
FAILED! => {"msg": "Unable to look up a name or access an attribute in template string ({{ bigip_device_facts.ltm-pools }}).\nMake sure your variable name does not contain invalid characters like '-': unsupported operand type(s) for -: 'StrictUndefined' and 'AnsibleUnicode'"}
to retry, use: --limit @/opt/project/facts.retry
Any ideas? Thanks.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects