ptavares.ansible_role_docker

Ansible Role for Docker

Overview

This is an Ansible role designed to install Docker and Docker Compose.

Requirements

  • Works with Ansible version 2.5 or higher.

Role Variables

You can customize the following variables (see defaults/main.yml for defaults).

Docker Options

# Choose Docker Edition: 'ce' for Community Edition or 'ee' for Enterprise Edition.
docker_edition: 'ce'
docker_package: "docker-{{ docker_edition }}"

# Install or remove the docker package: 'present' to install, 'absent' to uninstall.
docker_package_state: present

# List of users to add to the Docker group (the current user is added by default).
docker_users: []

Docker Service Options

# Set service state: started or stopped.
docker_service_state: started
# Enable service at boot or restart: yes or no.
docker_service_enabled: yes
# Control how the Docker service is managed:
# - started: start if stopped
# - stopped: stop if started
# - restarted: always restart
# - reloaded: always reload
docker_restart_handler_state: restarted

Docker Compose Options

# Whether to install Docker Compose; set to false if already installed and want to remove it.
docker_compose_install: true
# Default path for Docker Compose.
docker_compose_path: /usr/local/bin/docker-compose

Apt Options

For Advanced Users

# Available channels:
# - stable
# - edge
# - nightly
docker_apt_release_channel: stable
# URL for the apt key.
docker_apt_key_url: https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg
# Docker apt repository URL for amd64 architecture.
docker_apt_repository_url: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}"

Yum Options

For Advanced Users

# URL for the GPG key.
docker_gpg_key_url: https://download.docker.com/linux/centos/gpg
# Docker yum repository URL for Fedora/CentOS/RHEL.
docker_yum_repo_url: https://download.docker.com/linux/{{ (ansible_distribution == "Fedora") | ternary("fedora","centos") }}/docker-{{ docker_edition }}.repo

Dependencies

  • None

Example Playbook

- hosts: all
  roles:
    - role: ptavares.ansible_role_docker

Inside vars/main.yml:

  • Copy the contents from defaults/main.yml into your playbook's variable file.
  • Modify it as needed to set the role's variables.

License

MIT License.

Informazioni sul progetto

Ansible role for installating docker and docker-compose

Installa
ansible-galaxy install ptavares.ansible_role_docker
Licenza
mit
Download
183
Proprietario