You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
702 B
33 lines
702 B
---
|
|
|
|
- name: Merge two hashes with combine
|
|
gather_facts: no
|
|
hosts: localhost
|
|
tasks:
|
|
- block:
|
|
- debug:
|
|
var: output
|
|
- assert:
|
|
that:
|
|
- output.type == "person"
|
|
- output.spec.firstname == "jane"
|
|
- output.spec.lastname == "doe"
|
|
- output.extended_spec.age == 21
|
|
- output.extra.knows == "ansible"
|
|
vars:
|
|
output: "{{ input1|combine(input2, recursive=True) }}"
|
|
input1:
|
|
type: person
|
|
spec:
|
|
firstname: john
|
|
lastname: doe
|
|
extended_spec: {}
|
|
input2:
|
|
spec:
|
|
firstname: jane
|
|
extended_spec:
|
|
age: 21
|
|
extra:
|
|
knows: ansible
|
|
|
|
|
|
|