dict in dict access value in with_item

Hi,

I’ve got a dict in dict in a var file. When debuging this var, it looks like this:

"var": { "nm_java_apps_params": { "nm-core": { "dest_folder": '/tmp/test' "port": 9487, "start_options": " -Xmx16G -XX:+UseG1GC -XX:+UseStringDeduplication", "version": "latest" }, "nm-staticmaps": {“dest_folder”: ‘/tmp/test’"port": 9462, "start_options": "", "war_name": "latest.war" } } }

I would like to be able to use those vars in a role with a with_item statement. Here is what it looks like:

`

  • name: create operation folder
    file: path=“{{item}}” owner=user mode=0755 state=directory
    with_items:
  • nm_java_apps_params[“{{another_var_here}}”][‘dest_folder’]
    `

But I can’t get it correctly resolved. Here is what I got:

`
TASK: [nm.java-apps | create operation folder] ********************************

changed: [x.x.x.x] => (item=nm_java_apps_params[“my_var”][‘dest_folder’])
`

In fact it creates a folder named: “nm_java_apps_params[“my_var”][‘dest_folder’]”, which is of course what I’m not really expecting. I thought having ‘/tmp/test’ instead.

Any ideas on how I can resolve this problem ?

Thanks

I think you need ‘with_nested’ here?
http://docs.ansible.com/ansible/playbooks_loops.html

Alex

It works ! Thanks !