I struggled with deploying web services via Ansible to staging CoreOS host and that's something that looks like a hell!
I received one error, then another with just simple-simple steps like
- name: IT-Premium docker-compose deploy
- name: Install docker-py
pip: name=docker-py executable=/home/core/bin/pip
- name: Install PyYAML
pip: name=PyYAML executable=/home/core/bin/pip
- name: Install docker-compose
pip: name=docker-compose executable=/home/core/bin/pip version=1.9.0
- name: Creates it-premium directory
file: path=/home/core/it-premium state=directory
- name: copy docker-compose.yml
copy: src=./docker-compose.yml dest=/home/core/it-premium/docker-compose.yml
- name: copy sqlite
copy: src=./sqlite dest=/home/core/it-premium/ mode=0644
- name: docker registry login
- name: pull images
- name: launch it-premium docker-compose with 2 containers
You can notice version of docker-compose 1.9.0, which is supplied there. That's because of issue with
Error: cannot import name 'IPAMConfig'
thrown by docker_service.
And here is why https://github.com/ansible/ansible/issues/20492
This is due to your docker-compose version.
The docker-py package has been renamed into docker in version 2.0 (https://github.com/docker/docker-py/releases/tag/2.0.0). And in this version, Docker.Client has been renamed into docker.APIClient.
Docker-compose 1.10+ now requires docker instead of docker-py. And due to his name the docker package is before the docker-py one in the PYTHONPATH leading to the import error.
A workaround is to downgrade your docker-compose version to 1.9.0 the time the Ansible docker_container module updates its dependencies from docker-py to docker.
That's something like «piss on you, dirty user, because we do not care about backward compatibility».
Because when you change something, it is like delete old state and introduce new one instead. And when you delete something, that could broke anything that relies on state.
How to do instead? Just ADD something new without removal. Call it with new namespace, new function name and just use!