An Ansible Role to install and configure Docker on Linux.
Docker and Docker Containers are widely used. Setting up a docker service is very common and useful.
This role is setting up docker and configuring it from official repositories.
- install docker or docker-ce
- control the docker-ce repository
- optional: install docker-compose
- start docker service
- create docker group
- add users to group
Used Modules:
- Ansible package_facts Module
- Ansible package Module
- Ansible service Module
- Ansible systemd Module
- Ansible group Module
- Ansible user Module
Install from Github
git clone https://github.com/while-true-do/ansible-role-srv_docker.git while_true_do.srv_docker
Install from Ansible Galaxy
ansible-galaxy install while_true_do.srv_docker
---
# defaults file for while_true_do.srv_docker
## Package Management
wtd_srv_docker_package: "docker"
# State can be present|latest|absent
wtd_srv_docker_package_state: "present"
# Define the source of docker:
# Source can be dist|ce
# dist = repository of your distribution
# ce = official community docker repository
wtd_srv_docker_package_source: "dist"
# Only used for source = ce|ee
# *_enabled can be 0|1
wtd_srv_docker_package_edge_enabled: 0
wtd_srv_docker_package_test_enabled: 0
# Docker Compose Packages
# State can be present|latest|absent|unmanaged
wtd_srv_docker_compose_package_state: "unmanaged"
# Source can be binary
wtd_srv_docker_compose_package_source: "binary"
# Only used, when source = binary
wtd_srv_docker_compose_package_version: "1.24.1"
wtd_srv_docker_compose_package_path: "/usr/local/bin/docker-compose"
## Service Management
wtd_srv_docker_service: "docker"
# State can be started|stopped
wtd_srv_docker_service_state: "started"
wtd_srv_docker_service_enabled: true
## User and Group Management
wtd_srv_docker_group: "docker"
# State can be present|absent
wtd_srv_docker_group_state: "present"
# A list of user names.
wtd_srv_docker_group_users: []
Running Ansible Roles can be done in a playbook.
---
- hosts: all
roles:
- role: while_true_do.srv_docker
Add users to the docker group.
- hosts: all
roles:
- role: while_true_do.srv_docker
wtd_srv_docker_group_users:
- user1
- user2
wtd_srv_docker_service_enabled: "no"
Use the docker-ce version and install docker-compose.
- hosts: all
roles:
- role: while_true_do.srv_docker
wtd_srv_docker_compose_package_state: "present"
wtd_srv_docker_package_source: "ce"
- RedHat Testing is currently not possible in public, due to limitations in subscriptions.
- Some services and features cannot be tested properly, due to limitations in docker.
Most of the "generic" tests are located in the Test Library.
Ansible specific testing is done with Molecule.
Infrastructure testing is done with testinfra.
Automated testing is done with Travis CI.
Thank you so much for considering to contribute. We are very happy, when somebody is joining the hard work. Please fell free to open Bugs, Feature Requests or Pull Requests after reading the Contribution Guideline.
See who has contributed already in the kudos.txt.
This work is licensed under a BSD-3-Clause License.
- Site https://while-true-do.io
- Twitter https://twitter.com/wtd_news
- Code https://github.com/while-true-do
- Mail hello@while-true-do.io
- IRC freenode, #while-true-do
- Telegram https://t.me/while_true_do