I\'m currently building a role for installing PHP using ansible, and I\'m having some difficulty merging dictionaries. I\'ve tried several ways to do so, but I can\'t get it
It is now possible to use the anchor and extend features of YAML:
---
- hosts: localhost
vars:
my_default_values: &def
key: value
my_values:
<<: *def
my_key: my_value
tasks:
- debug: var=my_default_values
- debug: var=my_values
Result:
TASK [debug]
ok: [localhost] => {
"my_default_values": {
"key": "value"
}
}
TASK [debug]
ok: [localhost] => {
"my_values": {
"key": "value",
"my_key": "my_value"
}
}
I have no idea why this was not mentioned before.