franklinkim.docker
is an Ansible role which:
- installs docker
- configures docker
- adds logrotate for docker container logs
Using ansible-galaxy
:
$ ansible-galaxy install franklinkim.docker
Using requirements.yml
:
- src: franklinkim.docker
Using git
:
$ git clone https://github.com/weareinteractive/ansible-docker.git franklinkim.docker
- Ansible >= 2.0
Here is a list of all the default variables for this role, which are also available in defaults/main.yml
.
---
# For more information about handlers see:
# http://www.ansibleworks.com/docs/playbooks.html#handlers-running-operations-on-change
#
# pip dependencies
# docker_pip_dependencies:
# - name: docker-py
# version: 1.9.0
# docker_options:
# - "--dns 8.8.4.4"
# docker_containers:
# - image: foo/bar
# count: ...
# command: ...
# env: ...
# expose: ...
# hostname: ...
# labels: ...
# links: ...
# name: ...
# ports: ...
# privileged: ...
# pull: ...
# state: ...
# volumes: ...
# volumes_from: ...
#
# apt package
docker_package: docker-engine
# pip dependencies
docker_pip_dependencies:
- docker-py
# start on boot
docker_service_enabled: yes
# current state: started, stopped
docker_service_state: started
# docker default options
docker_options: []
# list of images (http://docs.ansible.com/docker_image_module.html)
docker_images: []
# list of containers (http://docs.ansible.com/docker_module.html)
docker_containers: []
These are the handlers that are defined in handlers/main.yml
.
---
- name: restart docker
service: name=docker state=restarted
when: docker_service_state != 'stopped'
This is an example playbook:
---
- hosts: all
become: yes
roles:
- franklinkim.docker
vars:
docker_options:
- "--bip=10.0.3.1/24"
docker_pip_dependencies:
- name: docker-py
version: 1.9.0
$ git clone https://github.com/weareinteractive/ansible-docker.git
$ cd ansible-docker
$ make test
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests and examples for any new or changed functionality.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Note: To update the README.md
file please install and run ansible-role
:
$ gem install ansible-role
$ ansible-role docgen
Copyright (c) We Are Interactive under the MIT license.