I want to conditionally pass --detach into argv like this:
- name: run docker container with service
command:
args:
argv:
- docker
- run
- "{{ '' if wait else '--detach' }}"
- "--restart=always"
- "--network=host"
- --log-driver
- fluentd
- --log-opt
- fluentd-async-connect=true
- --log-opt
- fluentd-sub-second-precision=true
- --log-opt
- mode=non-blocking
But it doesn't work because empty argv arguments are incorrectly passed to docker. Is there any workaround?