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