igor_nikiforov.docker
Ansible Role: Docker
This role installs and configures Docker, along with Docker Compose and the Docker SDK for Python.
Requirements
This role has been developed and tested with the following versions of Ansible:
Name | Version |
---|---|
ansible | >= 2.9.13 |
ansible-base | >= 2.10.1 |
ansible-core | >= 2.11.2 |
Other versions may work but have not been tested.
Installation
To install the latest stable version of this role, use the command ansible-galaxy install igor_nikiforov.docker
.
You can also install it via a requirements file using: ansible-galaxy install -r requirements.yml
:
# requirements.yml
---
roles:
- name: igor_nikiforov.docker
version: v1.1.0
Platforms
Name | Version |
---|---|
Debian | buster |
Ubuntu | focal, groovy |
CentOS | 7.4+, 8 |
RedHat | 7.4+, 8 |
Other operating systems may work but have not been tested. If you encounter any issues, please submit a pull request!
Variables
Name | Description | Default |
---|---|---|
docker_supported_architectures | List of supported Docker architectures | ["x86_64", "arm64", "armhf", "s390x"] |
docker_install | If set to True, Docker will be installed | true |
docker_version | Version of Docker to install | latest |
docker_bash_completion_install | If set to True, Docker bash completion will be installed | true |
docker_daemon_config | Configuration for the Docker daemon | {} |
docker_service_enabled | Whether the Docker service should start on boot | true |
docker_service_state | State of the Docker service | started |
docker_users | List of users to add to the Docker group | [] |
docker_sdk_for_python_install | If set to True, Docker SDK for Python will be installed | false |
docker_sdk_for_python_version | Version of Docker SDK for Python | latest |
docker_compose_install | If set to True, Docker Compose will be installed | false |
docker_compose_version | Version of Docker Compose | latest |
docker_compose_bash_completion_install | If set to True, Docker Compose bash completion will be installed | true |
Usage
This role supports all Docker daemon configuration parameters, which can be set using the docker_daemon_config
variable. You can find examples of the JSON config format in the Docker official documentation. Remember to convert the config from JSON to YAML format, for example, using this online tool.
Examples
# playbook.yml
---
- hosts: all
become: True
gather_facts: False
pre_tasks:
- wait_for_connection: { timeout: 300 }
- setup:
vars:
docker_sdk_for_python_install: True
docker_compose_install: True
docker_daemon_config:
default-address-pools:
- { base: 172.16.0.0/16, size: 26 }
log-driver: "json-file"
log-opts:
max-size: "10m"
max-file: "3"
tasks:
- name: Install Docker
import_role:
name: docker
License
MIT
Author Information
Install and configure Docker
ansible-galaxy install igor_nikiforov.docker