Add user to docker group functionality

This commit is contained in:
James McCallum 2017-09-03 19:21:17 +10:00
parent 2b507a374e
commit 2bf1b29d3f
3 changed files with 15 additions and 0 deletions

View File

@ -36,6 +36,12 @@ Docker Compose installation options.
(Used only for RedHat/CentOS.) You can enable the Edge or Test repo by setting the respective vars to `1`. (Used only for RedHat/CentOS.) You can enable the Edge or Test repo by setting the respective vars to `1`.
Set the docker_users variable to allow those users to run docker (these users are added to the docker group)
docker_users:
- Guy
- James
## Use with Ansible (and `docker` Python library) ## Use with Ansible (and `docker` Python library)
Many users of this role wish to also use Ansible to then _build_ Docker images and manage Docker containers on the server where Docker is installed. In this case, you can easily add in the `docker` Python library using the `geerlingguy.pip` role: Many users of this role wish to also use Ansible to then _build_ Docker images and manage Docker containers on the server where Docker is installed. In this case, you can easily add in the `docker` Python library using the `geerlingguy.pip` role:

View File

@ -17,3 +17,6 @@ docker_apt_repository: "deb https://download.docker.com/linux/{{ ansible_distrib
docker_yum_repo_url: https://download.docker.com/linux/centos/docker-{{ docker_edition }}.repo docker_yum_repo_url: https://download.docker.com/linux/centos/docker-{{ docker_edition }}.repo
docker_yum_repo_enable_edge: 0 docker_yum_repo_enable_edge: 0
docker_yum_repo_enable_test: 0 docker_yum_repo_enable_test: 0
# Docker users
docker_users: []

6
tasks/docker-users.yml Normal file
View File

@ -0,0 +1,6 @@
---
- name: Add users to docker group
user:
name: "{{ item }}"
group: docker
with_items: "{{ docker_users }}"