Add docker Ansible role

This commit is contained in:
2019-08-29 07:27:08 +00:00
parent 4e9d6e0f0f
commit 895a60a824
7 changed files with 135 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
---
- name: Remove any previous versions of Docker
package:
name:
- docker
- docker-engine
state: absent
- name: Add Docker gpg key to apt
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
state: present
register: add_repository_key
- name: Add Docker repository to apt
apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
state: present
update_cache: true
- name: Install Docker
package:
name: docker-ce
state: present
notify: restart docker

View File

@@ -0,0 +1,4 @@
---
- import_tasks: docker-install.yml
- import_tasks: users.yml

View File

@@ -0,0 +1,8 @@
---
- name: Add users to Docker group
user:
name: "{{ item }}"
groups: docker
append: true
with_items: "{{ docker_users }}"