Hi i hope not to a duplicate any post but I have a preety akward problem
with the docker module to ansible.
I have a services.yml file:
---
services:
- {service: articleadmin, tag: dev, add: "env='DATACENTER_ID={{dc_id}}'"}
- {service: articlemodule, tag: dev, add: "env='DATACENTER_ID={{dc_id}}'"}
- {service: authoradmin, tag: dev, add: "env='DATACENTER_ID={{dc_id}}'"}
- {service: catalogadmin, tag: dev, add: "env='DATACENTER_ID={{dc_id}}'"}
a all.yml file:
---
# service all
- hosts: dev
sudo: yes
vars_files:
- services.yml
roles:
- role: service.all
and a main.yml in roles/service.all/tasks
---
- name: Start docker service
service: name=docker state=started enabled=yes
- name: Stop running containers
docker: state=stopped image={{item.service}}:{{item.tag}}
with_items:
- "{{ services }}"
- name: Delete containers
docker: state=absent image={{item.service}}:{{item.tag}}
with_items:
- "{{ services }}"
- name: Run containers
docker: publish_all_ports=yes "{{item.add}}"
image=private.reg/{{item.service}}:{{item.tag}} registry=private.reg
insecure_registry=true
with_items:
- "{{ services }}"
and when I run this playbook the only thing working ok is starting
containers... stop, delete are returned as success (changed: 0 etc)
What is wrong with my approach?
Cheers
Dominik
--
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/7f5b7378-2460-4e7a-a030-0d81c10cb582%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.