How to modify json file on remote node?

Oh. You said that in your first post, and I totally overlooked it. Repeat after me:
Mustaches don’t nest.

Try this:

- name: Add some key/value pair
  ansible.builtin.set_fact:
    imported_var: "{{ imported_var.content | b64decode | from_json | default([])
                      | combine({'option4': '60',
                                 'option5': 'test',
                                 'option6': '1.2.3.4',
                                 'location': ip_address
                                }
                               )
                   }}"
2 Likes