Data manipulation — Ansible Documentation
docs.ansible.com › ansible › latestDec 21, 2021 · Data manipulation . In many cases, you need to do some complex operation with your variables, while Ansible is not recommended as a data processing/manipulation tool, you can use the existing Jinja2 templating in conjunction with the many added Ansible filters, lookups and tests to do some very complex transformations.
Appending to lists or adding keys to dictionaries in Ansible
newbedev.com › appending-to-lists-or-adding-keysSolution 1: Since Ansible v2.x you can do these: # use case I: appending to LIST variable: - name: my appender set_fact: my_list_var: ' { {my_list_myvar + new_items_list}}' # use case II: appending to LIST variable one by one: - name: my appender set_fact: my_list_var: ' { {my_list_var + [item]}}' with_items: ' { {my_new_items|list}}' # use case III: appending more keys DICT variable in a "batch": - name: my appender set_fact: my_dict_var: ' { {my_dict_var|combine ...