I am trying to convert docker-compose file into Ansible playbook. The challenge that I have is how to write the labels in ansible format.
The docker compose file below:
- name: run search container
docker_container:
name: search
image: docker-registry.xxxdev.xxxx.com/soxx/sxxxna-search:latest
volumes:
- /exec-ui/app-config/application.yml:/opt/xxxna-search/config/application.yml
- /exec-ui/app-config/logback.xml:/opt/xxxna-search/config/logback.xml
ports:
- "9090:9090"
labels:
- "traefik.port=9090"
- "traefik.frontend.rule=PathPrefix:/search/xxxxx
I'm using ansible 2.4.2.0 Thanks for the help
Yaniv
The solution is very simple.
Just remove the '-' and ' "" ' as follows
Before the change:
labels:
- "traefik.port=9090"
- "traefik.frontend.rule=PathPrefix:/search/xxxxx
After the change to ansible playbook:
labels:
traefik.port: "9090"
traefik.frontend.rule: "PathPrefix:/search/,/xxxx