I created a vagrant environment to rapidly test code, and a custom inventory.py. But alas, hosts: dockerexp.dev doesn’t work, so screw it, hosts: all.
Now I have functional environment, time to do some docker stuff, try a simple docker_login: and find that it doesn’t work. What’s this docker-py thingy? I have docker-py on my host development system. From Ansible’s marketing, I get that Ansible doesn’t require any agent, it’s simple, all that. So, I am accustom that is a push tech. Research later, find many others confused, find Ansible ticket, and most to their horror or chagrin, docker-py needs to be installed on the server. WHAT?!?!? confused.
- http://stackoverflow.com/questions/38181433/ansible-cannot-import-docker-py-even-though-it-is-installed
- https://github.com/ansible/ansible-modules-core/issues/4246
Alright, install pip on Ubuntu… WTF 26 package dependencies… No way… easy_install pip, pip install docker-py.
Good to go, back to docker fun, ansible-playbook …
WTF… Minimum version is 1.7.0, which is greater than 1.10.0? or something, WTF… google, google, google.
- Issue: https://github.com/ansible/ansible-modules-core/issues/4047
- PR: https://github.com/ansible/ansible-modules-core/pull/4048/commits
Apparently, there’s been a bug there for a while, maybe it only showed up at 1.10.0. Installed 1.7.0, works. Installed 1.9.0, works.
Finally, now I can do docker… ansible-playbook… FAIL… Aaaaaah… but this time, it’s my fault… fixed.
Ultimately, came up with these tasks for anywhere you want to use docker module, at least on Ubuntu:
- name: Install easy_install
apt: name=python-setuptools update_cache=yes
- name: Install pip
easy_install: name=pip state=latest
- name: Install docker-py
pip: name=docker-py version=1.9.0