/ansible-role-docker

Ansible role for installing Docker

Primary LanguageShellMIT LicenseMIT

docker logo

Ansible role: docker

Build Status License Ansible Role

Description

Install and configure docker containerization platform.

Requirements

  • Ansible >= 2.4

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 (v2.x). You will have to install Docker on your system. See "Get started" for a Docker package suitable to for your system. We are using tox to simplify process of testing on multiple ansible versions. To install tox execute:

pip install tox

To run tests on all ansible versions (WARNING: this can take some time)

tox

To run a custom molecule command on custom environment with only default test scenario:

tox -e py27-ansible25 -- molecule test -s default

For more information about molecule go to their docs.

If you would like to run tests on remote docker host just specify DOCKER_HOST variable before running tox tests.

License

This project is licensed under MIT License. See LICENSE for more details.

Author Information

You can find me on Twitter: @mongrelion

Contributors