The when is evaluated for each step in the loop, not before looping, which
is the source of confusion here.

On Fri, Oct 17, 2014 at 6:04 AM, bshbg <[email protected]> wrote:

> I have the following two statements which have the same when part. The
> first one is skipped correctly but the second creates an error. It should
> be skipped also.
>
> - debug: var="{{ sites[env].restricted_areas }}"
>   when: sites[env].restricted_areas is defined
>
> - template: src="apache/site_credentials" dest="{{ apache_vhost_base_path
> }}/{{ sites[env].server_name }}/conf/{{ item.area.internal_name }}"
>   with_items: sites[env].restricted_areas | list
>   when: sites[env].restricted_areas is defined
>   tags: create
>
>
>
> result:
>
> TASK: [website | debug var="{{sites[env].restricted_areas}}"]
> *****************
> skipping: [TSSDMZPORTAL002]
>
>
> TASK: [website | template src="apache/site_credentials" dest=
> "{{apache_vhost_base_path}}/{{sites[env].server_name}}/conf/{{item.area.internal_name}}"
> ] ***
> fatal: [TSSDMZPORTAL002] => with_items expects a list or a set
>
>
> can someone help me?
>
> --
> 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/eb330a83-d434-4d8f-8022-0f9acafff636%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/eb330a83-d434-4d8f-8022-0f9acafff636%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/CA%2BnsWgyMHp1kSb4XKAH-HtTxBiax5hdtJq%2BHP3uae_dysLWsYA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to