when runs for EACH item from with_items, so you cannot use it to avoid
undefined with_items, but you can do this:
with_dict: deploy_modules_php|default({})
which will return an empty dict, which will also skip the loops
On Fri, Jun 26, 2015 at 11:49 AM, Samnang Sen <[email protected]> wrote:
> I have a task that installs PHP and Perl modules against a group of servers.
> Servers w/ the word "batch" in their hostname run both Perl and PHP tasks
> (remove Perl tasks for simplicity). It seems the "Set PHP status success"
> task runs against machines w/ the word "batch" in them. ANy way I can skip
> it?
>
> - name: Install PHP modules
> command: sudo rpm -Uvh {{ rpm_repository }}/{{ item.key }}-{{
> item.value.svn_tag }}.rpm --force
> with_dict: deploy_modules_php
> register: php_command_result
> when: "'batch' in ansible_hostname"
> ignore_errors: True
>
> - name: set PHP status fail
> when: php_command_result|failed
> set_fact:
> color="red"
> msg="Unable to install PHP RPMs!"
>
> - name: Set PHP status success
> when: php_command_result|success
> set_fact:
> color="green"
> msg="Successfully installed PHP RPMs!"
>
> --
> 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/7d4e229d-bfa6-408f-a796-577e381a59d3%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
Brian Coca
--
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/CAJ5XC8k7SEpDEBhUwm7BshzcXK9rcAVTTzvUriDDqf0RZZ_W8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.