Docker module not responding correctly to commands

64 views
Skip to first unread message

Dominik Kierzek

unread,
Oct 9, 2014, 9:32:25 AM10/9/14
to ansible...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages