merging dictionaries in ansible

前端 未结 6 931
日久生厌
日久生厌 2020-12-03 06:47

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

6条回答
  •  时光取名叫无心
    2020-12-03 06:59

    If you need the merged dictionary a few times, you can set it to a new "variable":

    - set_fact: _my_values="{{ my_default_values|combine(my_values) }}"
    
    - debug: msg="{{ item.key }} = {{ item.value }}"
      with_dict: _my_values
    

提交回复
热议问题