How to traverse a nested dict structure with Ansible?

房东的猫 提交于 2019-12-03 14:31:10

You can use with_subelements to loop through the server_aliases. The below snippet

 - name: Add a domain symlinks /tmp for server_name.
    debug: msg="{{ item.server_name }}"
    with_items: apache_vhosts
  - name: Add a domain symlinks /tmp for server_aliases.
    debug: msg="name - {{ item.0.name }} and serverAlias - {{ item.1 }}"
    with_subelements: 
     - apache_vhosts
     - server_aliases 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!