3.6 KiB
Ansible role: docker
Description
Install and configure docker containerization platform.
Requirements
- Ansible >= 2.3
Role Variables
All variables which can be overridden are stored in defaults/main.yml file as well as in table below.
Name | Default Value | Description |
---|---|---|
docker_compose |
yes | Install docker-compose package |
docker_proxy |
no | Enable HTTP proxy setup |
docker_http_proxy |
"" | HTTP proxy server address |
docker_https_proxy |
"" | HTTPS proxy server address |
docker_no_proxy |
"" | Comma-separated list of hosts which won't use HTTP proxy |
docker_version |
"17.06" | docker version which should be installed on target server. Can use latest for updates |
docker_default_config |
[ storage-driver: devicemapper, log-level: info ] | Docker daemon configuration |
docker_users |
[] | Add users to docker group. Users must exist before adding. Construct like - {{ ansible_env['SUDO_USER'] | default(ansible_user_id) }} could be used to specify user which is used for ansible connection to host. |
Example
Playbooks
Just install Docker with default config
- hosts: servers
roles:
- mongrelion.docker
Install and configure docker daemon
- hosts: servers
roles:
- role: mongrelion.docker
docker_config:
live-restore: true
userland-proxy: false
Local Testing
The preferred way of locally testing the role is to use Docker and molecule (v1.25). You will have to install Docker on your system. See Get started for a Docker package suitable to for your system. All packages you need to can be specified in one line:
pip install ansible 'ansible-lint>=3.4.15' 'molecule==1.25.0' docker 'testinfra>=1.7.0,<=1.10.1' jmespath
This should be similar to one listed in .travis.yml
file in install
section.
After installing test suit you can run test by running
molecule test
For more information about molecule go to their docs.
License
This project is licensed under MIT License. See LICENSE for more details.
Author Information
You can find me on Twitter: @mongrelion
Contributors
- Carlos Leon (@mongrelion)
- Paweł Krupa (@paulfantom)
- Marcus Levine (@marcusianlevine)
- Manuel Hutter (@mhutter)
- Dmitri Bichko (@dbichko)
- Zane Westover (@zanewestover)
- Bruce Becker (@brucellino)
- David Wahlstrom (@drwahl)
- Max Oreshnikov (@maxim0r)
- Nicholas E. Rabenau (@nerab)
- Petr Balogh (@petr-balogh)
- ramz (@ageekymonk)