Suppose i want to start a docker container and its parameters would differ
based on a condition. Something like this:
docker_container:
name: typeA
image: typeA
volumes:
- a1:a1
- a2:a2
when: type == A
docker_container:
name: typeB
image: typeB
volumes:
- b1:b1
- b2:b2
privileged: yes
when: type == B
I want to avoid writing and maintaining two similar tasks when i know
always only one of them will execute. So is there a more elegant way to do
this ? Like i define the differences in a dict var and only specify one
docker_container.
I tried this but this didn't work. I was hoping that there is something
similar possible
Avars:
name: typeA
image: typeA
volumes:
- a1:a1
Bvars:
name: typeB
image: typeB
volumes:
- b1:b1
- b2:b2
privileged: yes
docker_container: "{{ (type == A) | ternary ( Avars, Bvars) }}"
--
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/feafaf1c-f534-42af-9959-17ffc5148846%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.