I sometimes need to convert from a dictionary tree (like in data.yml
) to a specific json formatted output file using Ansible.
In this case, I've used a combination of set_fact
, a for loop
and a combine
filter to build my output. I'm
also using a regex_search to make sure I'm only getting records where the data I'm interested in is there!
Hope it's useful to people!