Why: I want to have some containers running for playing with (..) (running Docker container on a VM is not the most efficient way to go, but for development it's alright)
I use OpenStack. You can get one for free on Amazon. Probably also free tier in Rack, Euca ,...
sudo-capable SSH user, with my key in .ssh/authorized_keys
^ you get in any IaaS environment
The node must be in inventory, and Ansible must be able to reach it:
ansible -m ping docker1
. If your inventory is not so smart, you would use IP address.
I use nova inventory. Show output.
To install docker daemon and kernel extensions without reading any docs and without connecting to the machine
(This could be done w/ CoreOS, but CoreOS doesn't have Python, so no Ansible out of the box.)
a cool role in galaxy as docker.ubuntu: https://github.com/angstwad/docker.ubuntu
It takes care of docker installation.
The normal way: get the role, write playbook applying the role in the node.
My way:
ansible-apply-role-to-host -r https://github.com/angstwad/docker.ubuntu docker1
There is a Docker module for Ansible: http://docs.ansible.com/docker_module.html
I prepared a simple role: https://github.com/t0mk/dockerdemo
Show cloned tree, and tasks/main.yml
It runs the training Flask app (image training/webapp) in each container and maps to ports 800{1,2,3} of the Docker host. The app just replies with "Hello world !"
again:
ansible-apply-role-to-host -r https://github.com/t0mk/dockerdemo docker1
curl <host>:800{1,2,3}
- With Ansible it's super-simple to get code from the Internet and immediately test it. It will not work on the first try but most likely on the second. I misse d this when working with Puppet.
- Simple to handle docker containers with Ansible.
- I did not SSH anywhere.
- I did not upload or download anything.
ansible-apply-role-to-host
in my repo: https://github.com/t0mk/ansible-utils
Would You recommend just for getting more familiar with Ansible the AWS Free Tier or just a plain local virtual machine?