I am not sure I have fully understood your example but if the goal is to 
install someArtifact and a corresponding someArtifact-properties, but also 
allow for there not to be a someArtifact-properties, (in which case you 
would just install 'someArtifact', then you might be able to make use of 
default(omit) syntax - see the example here: 
 
http://docs.ansible.com/ansible/latest/playbooks_filters.html#omitting-parameters

Hope this helps,

Jon


On Tuesday, September 5, 2017 at 12:53:53 PM UTC+1, Tom Bartsch wrote:
>
> Hi there,
>
> I have the following playbook:
>
> ---
> - hosts: "{{ host }}"
>   vars:
>     bundle_artifacts:
>       - artifactId: "someArtifact"
>         version: "1.0.0"
>         extension: "zip"
>       - artifactId: "kietmyartifact-properties"
>         version: "5.0.0"
>         extension: "jar"
>       - artifactId: "kiatmyartifact-properties"
>         version: "5.0.0"
>         extension: "jar"
>       - artifactId: "kiprmyartifact-properties"
>         version: "5.0.0"
>         extension: "jar"
>
>   tasks:
>   - set_fact:
>       bundle_artifacts_without_non_current_env_properties: "{{ 
> (bundle_artifacts_without_non_current_env_properties | default([])) + 
> [{'artifactId':item.artifactId, 
> 'version':item.version,'extension':item.extension}] }}"
>     with_items: "{{ bundle_artifacts }}"
>     when: ('"{{ product }}-properties" not in item.artifactId') or ('"{{ env 
> }}{{ product }}-properties" in item.artifactId')
>
>
>
> env is a property that depends on the host the execution is for. Values of 
> env could be: et, at, qs or pr.
> product is a property that depends on the host the execution is for too. 
> Assume the value is here: myartifact
>
>
> Now my problem is that after executing the task above 
> bundle_artifacts_without_non_current_env_properties contains the same 
> elements like bundle_artifacts.
>
> I would like to have the following artifacts in 
> bundle_artifacts_without_non_current_env_properties if product was 
> "myartifact" and env was "at":
>
> someArtifact and kiatmyartifact-properties.
>
> The artifacts kietmyartifact-properties and kiprmyartifact-properties should 
> be ignored.
>
>
> Does anybody know what I have to do to get this work?
>
> Regards,
> Tom
>
>

-- 
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/09e06a6f-be8a-49b0-95c0-9c307a6c34df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to