Hi
I have a playbook that displays a warning when certain legacy variables are
found.
This works, but I am looking for an alternative that does not involve a
looped task.
My attempt below works only partly, because select('defined') does not work
for a nested variable.
What could be a solution?
---
- hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Find legacy vars (with loop)
debug:
msg: "Found legacy var {{ item }}"
loop: "{{ legacy }}"
when: vars | json_query(item)
- name: Find legacy vars (without loop)
debug: var=vars|select('defined')|intersect(legacy)
vars:
foo1: asdfasdfas
foo2: k2jl34k234
foo3: asdfasdfasf
foo4: 2aslfdkjasdf
foo:
bar:
baz: argsd2
bar1: 3asdfkjlasdf
bar2: zzzuahys
legacy:
- foo1
- foo2
- bar3
- foo.bar.baz
- foo6
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAF8BbLYtY6JVxacfzXq%2BVg_WV5%3DkEC6YhcMWhU9cO5gAGdbSpA%40mail.gmail.com.