I think you need 'with_nested' here? http://docs.ansible.com/ansible/playbooks_loops.html
Alex On 7 Nov 2015 1:48 p.m., "Pierre Mavro" <[email protected]> wrote: > 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 > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/eebc8ab0-3e82-435a-bcdd-d14535a640cc%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/eebc8ab0-3e82-435a-bcdd-d14535a640cc%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CACSH3MvXNANvQV%3DEkAaBbvYhhFGjxoTtUuqWqtXxZW%3DtA2RYug%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
