You have an errant trailing ' at the end of your 'when' line: when: item.key == "php" or item.key == "perl"' Should instead be:
when: item.key == "php" or item.key == "perl" I tested with that change and everything works as expected. One potential improvement: when: item.key in ["php", "perl"] -- Matt Martz [email protected] On May 7, 2014 at 3:42:39 PM, Samnang Sen ([email protected]) wrote: Here's the full thing, # This is from my group var file. # cat groups_vars/deploy_list deploy_modules: php: tag: 'abc123' svn_path: 'path_to_svn' document_root: '/tmp' perl: tag: 'abc987' svn_path: 'path_to_svn' document_root: '/tmp' # end file - name: Deploying Modules action: shell svn export --username myuser --password mypassword {{ repository }}/{{ item.value.svn_path }}/tags/{{ item.value.tag }} /tmp/{{ item.key }}.{{revision_no}} with_dict: deploy_modules - name: Modify ownership shell: chown www:www {{ module_path }} with_dict: deploy_modules when: item.key == "php" or item.key == "perl"' On Wednesday, May 7, 2014 4:39:12 PM UTC-4, Strahinja Kustudić wrote: How and where did you define deploy_modules? On Wednesday, May 7, 2014 10:27:36 PM UTC+2, Samnang Sen wrote: Still not working. TASK: [web | Modify ownership] ***************************************************** fatal: [oqn-qc-web01] => error while evaluating conditional: item.key == "php" or item.key == "perl"' fatal: [oqn-qc-web02] => error while evaluating conditional: item.key == "php" or item.key == "perl"' On Monday, May 5, 2014 9:18:28 PM UTC-4, James Cammarata wrote: When using "when:", you don't have to wrap variables in braces. Just do this: when: item.key == "php" or item.key == "perl" For example, the following works for me: $ cat test_with_dict.yml - hosts: localhost connection: local gather_facts: no vars: - values: foo: val1: "this is foo value 1" val2: "this is foo value 2" bar: val1: "this is bar value 1" val2: "this is bar value 2" baz: val1: "this is baz value 1" val2: "this is baz value 2" bam: val1: "this is bam value 1" val2: "this is bam value 2" tasks: - name: do loop over values dictionary debug: var=item.value.val1 with_dict: values when: item.key == 'foo' or item.key == 'bar' On Mon, May 5, 2014 at 3:57 PM, Samnang Sen <[email protected]> wrote: I have a list of modules I would like to deploy. With certain modules, I want to run a specific command against it. For example, if the module is a PHP or PERL module, I want to modify the ownership of the folder. If it's anything else, ignore the task. The task below fails - name: Modify ownership shell: chown www:www {{ module_path }} with_dict: deploy_modules when: '"{{ item.key }} == "php" or {{ item.key }} == "perl"' TASK: [web | Modify ownership] ***************************************************** fatal: [web01] => error while evaluating conditional: "php == "perl" or php == "php" fatal: [web02] => error while evaluating conditional: "php == "perl" or php == "php" -- 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/11fc9d73-a04b-42c3-955b-d555015253b4%40googlegroups.com. 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/991d54f1-10a7-41de-946a-0f366cf20bb8%40googlegroups.com. 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/etPan.536a9d12.643c9869.3b77%40mobiletuvix.rackspace.corp. For more options, visit https://groups.google.com/d/optout.
