weareinteractive.docker
is an Ansible role which:
- installs docker
- configures docker
- adds logrotate for docker container logs
Note:
Since Ansible Galaxy switched all role names to the organization name, this role has moved from
franklinkim.docker
toweareinteractive.docker
!
Using ansible-galaxy
:
$ ansible-galaxy install weareinteractive.docker
Using requirements.yml
:
- src: weareinteractive.docker
Using git
:
$ git clone https://github.com/weareinteractive/ansible-docker.git weareinteractive.docker
- Ansible >= 2.4
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-ce
# 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: []
# centos docker ce private repository url
centos_docker_ce_private_repo: 'https://download.docker.com/linux/centos/7/$basearch/stable'
centos_docker_ce_private_repo_gpg: 'https://download.docker.com/linux/centos/gpg'
# debian docker ce private repository url
debian_docker_ce_private_repo: 'https://download.docker.com/linux/{{ ansible_distribution | lower }}'
debian_docker_ce_private_repo_gpg: 'https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg'
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:
- weareinteractive.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.