Hey,

I've this weird situation when I'm passing json(as a string) it still 
reordering it's order and not consistent.

Example:

my_var: |
  {
    "b": 1
    "a": 2
  }


when running ansible with

- name: "Set up json file"
  copy:
    dest: "/tmp/file.json"
    content: "{{ my_var }}"


every ansible run the file is being changed(because json order is being 
changed), in order to fix it I'm using:
content: "{{ my_var | from_json | to_nice_json }}"

This command keeps the order the same each run, because to_nice_json 
<https://github.com/ansible/ansible/blob/80d977bac65768bdd5cd675b9d1794640749431a/lib/ansible/plugins/filter/core.py#L85>
 
sorts the output (`sort_keys=True`).

My question is why *my_var* is being changed all the time even it's a 
string and *not* json

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0279bf34-bd76-40ca-b7ab-cae234d07c9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to