This is a simple role that facilitates the mighty docker-compose. It's by nomeans perfect, but satisifies my current needs to create dependent docker containers in a more dynamic way using the aforementioned docker-compose.
You need to have docker and docker-compose (I guess docker.py) installed.
The following variables are available:
docker_compose_src_template: /path/to/docker-compose_my_template.yml.j2
It sets the path to a docker-compose template file. The path can be anywhere, and is not bound to the relative location of the role. Due to the nature, this variable has no default value and has to be set.
docker_compose_dest: /my/remote/destination/path
Sets the destination path on the machine that's provisioned. Also this variable has no default value because it depends on your specifics.
docker_compose_file: my-docker-compose.yml # default: docker-compose
The docker-compose file to be used by docker-compose -f {{ docker_compose_file }} [up | stop | rm]
docker_compose_rebuild_images: no # default: no
Force stop container and removal.
This role makes vivid use of tags. The following tags are available:
- docker-compose
- docker-compose-up
- docker-compose-stop
- docker-compose-rm
- docker-compose-rebuild-images
- docker-compose-template
- debug
TODO: Make example ;)
A working example can be found at mychiara/ansible-docker-compose-example.
In lieu of a formal styleguide, take care to maintain the existing coding style. Would be create if you added unit tests, that's on my todo list aswell :]
- Fork it
- Create your feature branch (git checkout -b feature/my-cool-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin feature/my-new-feature)
- Create new Pull Request
Copyright (c) mychiara | svs under the GPLv2 license.