I am trying to save a set of the registered variables as a dictionary to a file. I can find the solution to save multiple variables to a file here Ansible: Save registered variables to file But I want to be able to save the variables as a dictionary
---
- name: Get variable1
shell: "some java command"
register: variable1
- name: Get variable2
shell: "some java command"
register: variable2
Now, I want to save them to a file in the form of dictionary like
dictionary_variable:
var1: "{{ variable1 }}"
var2: "{{ variable2 }}"
I should be able to access the dictionary like
{{ dictionary_variable.var1 }} or {{ dictionary_variable.var2 }}