# Any interest in docker-machine modules?

**URL:** <https://forum.ansible.com/t/any-interest-in-docker-machine-modules/20113>\
**Category:** Ansible Project\
**Created:** [January 3, 2016, 10:27pm UTC](https://forum.ansible.com/t/any-interest-in-docker-machine-modules/20113 "2016-01-03T22:27:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_Rowlands](https://avatars.discourse-cdn.com/v4/letter/j/22d042/32.png) [@Jonathan\_Rowlands](https://forum.ansible.com/u/Jonathan_Rowlands)\
**Post date:** [January 3, 2016, 10:27pm UTC](https://forum.ansible.com/t/any-interest-in-docker-machine-modules/20113/1 "2016-01-03T22:27:54Z")

</div>

Greetings! I created a primitive suite of docker-machine modules:

[https://github.com/jgrowl/ansible-docker-machine](https://github.com/jgrowl/ansible-docker-machine)

You can create playbooks like:

> > - hosts: 127.0.0.1
> 
> > connection: local
> 
> > tasks:
> 
> > - docker\_machine\_digitalocean: name={{ item.name }} region={{ item.region }} access\_token=ABCDEFGHI private\_networking=true state=running
> 
> > with\_items:
> 
> > - { name: ‘test-east-00’, region: ‘nyc3’ }
> 
> > - { name: ‘test-west-00’, region: ‘sfo1’}
> 
> > - { name: ‘test-asia-00’, region: ‘sgp1’}

Or a more generic version without any argument\_spec checks:

> - docker\_machine: name=test123 driver=digitalocean region=nyc1 access\_token=ABCDEFGHI state=running

Currently the modules don’t do much except let you create/destroy machines. You can see the logic that all of them use in the module\_util:  
[https://github.com/jgrowl/ansible-docker-machine/blob/master/module\_utils/docker\_machine.py](https://github.com/jgrowl/ansible-docker-machine/blob/master/module_utils/docker_machine.py)

You will also notice that the logic in the module\_util use a docker-machine-py client that I created specifically for use in these ansible modules:  
[https://github.com/jgrowl/docker-machine-py](https://github.com/jgrowl/docker-machine-py)

The ansible-docker-machine and docker-machine-py projects are still pretty messy and not feature complete. I just wanted to put them out there if anyone would find them useful.  
I am also very open to tips, suggestions, etc.

It’s not added to the repo yet, but I am also playing around with the idea of creating a docker\_machine connection plugin that leverages the recent docker connection. I am thinking it would work by setting the ansible\_connection in the hosts file like:

> [consul\_servers]  
> test-east-00 ansible\_connection=docker\_machine

Maybe an extra ‘docker\_machine\_name’ could be specified

Again suggestions or constructive criticism is very welcome! Thanks and cheers!

---

<div class="post-metadata">

**Author:** ![Greg\_DeKoenigsberg1](https://avatars.discourse-cdn.com/v4/letter/g/838e76/32.png) [@Greg\_DeKoenigsberg1](https://forum.ansible.com/u/Greg_DeKoenigsberg1)\
**Post date:** [January 4, 2016, 2:53pm UTC](https://forum.ansible.com/t/any-interest-in-docker-machine-modules/20113/2 "2016-01-04T14:53:07Z")

</div>

I'd be interested in seeing something like this. Right now I'm using  
docker-machine for some projects, and the way I'm orchestrating  
multiple containers on my laptop is Ansible with local raw commands.

I'm sure the Docker folks would tell you that docker-compose is the  
way to go here, but for people who are more comfortable with Ansible,  
it would be nice to have an alternative.

Of course, if Docker would just put Python in their docker-machine  
image, it wouldn't be an issue, but ¯\_(ツ)\_/¯

--g
