Ansible lookup values from complex structure?

安稳与你 提交于 2019-11-28 00:34:42

selectattr jinja filter is your friend here:

- debug: msg="{{ (vpc_subnet_facts.subnets | selectattr('tags.Name','equalto','mytag1') | first).id }}"

What is done here: make a subset of elements from vpc_subnet_facts.subnets where tags.Name=='mytag1', take first element, take id field.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!