ansible-jsonpatch
ansible-jsonpatch copied to clipboard
How to add object with multiple values into array
Hello, i have this json
{
"repositories": [
{
"name": "some-name",
"type": "vcs",
"url": "[email protected]"
}
]
}
and i am trying to create this
{
"repositories": [
{
"name": "some-name",
"type": "vcs",
"url": "[email protected]"
},
{
"name": "new-value",
"type": "vcs",
"url": "[email protected]"
}
]
}
but i dont know how. Is there possibility add multiple values into object?
like this:
- name: append key/values
json_patch:
src: /file.json
operations:
- op: add
path: '/repositories/-'
value:
name: "new-value"
type: "vcs"
url: "[email protected]"
pretty: yes
create: yes