gbolo.docker
Docker - Ansible Role
This Ansible role installs and configures Docker on:
- RHEL/CentOS 7
- Debian/Ubuntu
This role only supports Docker versions 1.11 and above.
Requirements
- Operating Systems: CentOS 7 or Ubuntu
- Internet access to the Docker CE package repository (https://download.docker.com)
Role Variables
You can customize the Docker installation using these variables:
# OS Configuration ------------------------------------------------------------
## Use the official Docker repository
docker_repo_enabled: true
## Enable Docker repository channels
docker_repo_channel_stable_enabled: true
docker_repo_channel_edge_enabled: false
docker_repo_channel_test_enabled: false
## Name of the Docker package to install
docker_pkg_name: "docker-ce"
## State of the package (e.g., present, latest)
docker_pkg_state: present
## Name of the Docker service
docker_service_name: "docker"
## Should the Docker daemon start on boot?
docker_service_enable: true
## Group name for Docker socket file
docker_group: "docker"
## Should we install python-docker-py for Ansible Docker modules?
docker_install_py_module: false
# Proxy Settings ---------------------------------------------------------------
## Should the Docker daemon use a proxy for external connections?
docker_proxy_enabled: false
## List of environment variables to set (comment out the ones you don't need)
docker_proxy_env:
- "HTTP_PROXY=http://proxy.example.com:80/"
- "HTTPS_PROXY=https://proxy.example.com:443/"
- "NO_PROXY=localhost,127.0.0.1,internalhub.example.com"
# Docker Client Configuration -------------------------------------------------
## Enable authentication for the Docker registry
docker_client_config_enabled: false
## Location to save client configuration
docker_client_config_location: "/root/.docker/config.json"
# Use something like the following for auth (docker login):
#docker_client_config:
# auths:
# "https://example.com:1234":
# auth: "SOME_STRING"
# email: "SOME_EMAIL"
# Default dockerd configuration options ---------------------------------------
docker_config_data_root: "/var/lib/docker"
docker_config_log_driver: ""
docker_config_log_opts: {}
docker_config_max_concurrent_downloads: 3
docker_config_max_concurrent_uploads: 5
docker_config_debug: false
docker_config_log_level: ""
docker_config_bridge: ~
docker_config_bip: "172.16.0.1/24"
docker_config_fixed_cidr: "172.16.0.0/24"
docker_config_fixed_cidr_v6: ""
docker_config_default_gateway: ""
docker_config_default_gateway_v6: ""
docker_config_selinux_enabled: false
docker_config_ip: "0.0.0.0"
docker_config_group: "{{ docker_group }}"
docker_config_insecure_registries: []
# You can add additional custom Docker settings here:
docker_config_custom: {}
Example Playbooks
Install the latest stable Docker on a CentOS server
- hosts: localhost
roles:
- { role: gbolo.docker, docker_pkg_state: latest }
Install the latest edge Docker on a CentOS server
- hosts: localhost
roles:
- { role: gbolo.docker, docker_pkg_state: latest, docker_repo_channel_edge_enabled: true }
Install an older stable Docker on a CentOS server
- hosts: localhost
roles:
- { role: gbolo.docker, docker_pkg_name: docker-ce-18.03.1.ce-1.el7.centos }
Advanced playbook with various settings
- hosts: localhost
vars:
# Store Docker containers/images in /opt/docker
docker_config_data_root: /opt/docker
# Change Docker bridge subnet
docker_config_bip: 172.16.77.77/24
# Set default log driver to journald
docker_config_log_driver: journald
# Define additional settings
docker_config_custom:
# Enable experimental mode
experimental: true
# Expose Docker API over socket and TCP
hosts:
- unix:///var/run/docker.sock
- tcp://0.0.0.0:2376
# Set default search domains
dns-search:
- lab1.linuxctl.com
- lab2.linuxctl.com
roles:
- role: gbolo.docker
Author and License
The docker
role was created by:
- George Bolo | linuxctl.com
License: MIT
FREE SOFTWARE, HELL YEAH!
Informazioni sul progetto
Role for Installation and Configuration of Docker
Installa
ansible-galaxy install gbolo.docker
Licenza
mit
Download
123
Proprietario
Father, Husband, Engineer