使用 'Ansible' 为 'Traefik'(代理服务器)编写标签
Writing labels for 'Traefik' (proxy server) using 'Ansible'
我正在尝试将 docker-compose 文件转换为 Ansible 剧本。
我面临的挑战是如何以 ansible 格式编写标签。
下面的docker撰写文件:
- 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
我正在使用 ansible 2.4.2.0
感谢帮助
亚尼夫
解决方法很简单。
只需删除'-'和'""',如下所示
变更前:
labels:
- "traefik.port=9090"
- "traefik.frontend.rule=PathPrefix:/search/xxxxx
更改为ansible playbook后:
labels:
traefik.port: "9090"
traefik.frontend.rule: "PathPrefix:/search/,/xxxx
我正在尝试将 docker-compose 文件转换为 Ansible 剧本。 我面临的挑战是如何以 ansible 格式编写标签。
下面的docker撰写文件:
- 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
我正在使用 ansible 2.4.2.0 感谢帮助
亚尼夫
解决方法很简单。
只需删除'-'和'""',如下所示
变更前:
labels:
- "traefik.port=9090"
- "traefik.frontend.rule=PathPrefix:/search/xxxxx
更改为ansible playbook后:
labels:
traefik.port: "9090"
traefik.frontend.rule: "PathPrefix:/search/,/xxxx