From 736e80379881f3da896ecd6a7972d15c503ecb00 Mon Sep 17 00:00:00 2001 From: Erik Stambaugh Date: Mon, 3 Jan 2022 07:41:24 -0800 Subject: [PATCH] Break out docker installation to its own role --- roles/docker/tasks/main.yaml | 20 ++++++++++++++++++++ roles/nextcloud/tasks/main.yaml | 4 +--- site.yaml | 1 + 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 roles/docker/tasks/main.yaml diff --git a/roles/docker/tasks/main.yaml b/roles/docker/tasks/main.yaml new file mode 100644 index 0000000..0b2b04b --- /dev/null +++ b/roles/docker/tasks/main.yaml @@ -0,0 +1,20 @@ +--- + +- name: install docker + apt: + force_apt_get: yes + name: "{{ packages }}" + vars: + packages: + - docker.io + - docker-compose + +- name: Add users to docker group + user: + name: "{{ item }}" + groups: docker + append: yes + with_items: + - ubuntu + + diff --git a/roles/nextcloud/tasks/main.yaml b/roles/nextcloud/tasks/main.yaml index d7f3ccb..20f067a 100644 --- a/roles/nextcloud/tasks/main.yaml +++ b/roles/nextcloud/tasks/main.yaml @@ -10,14 +10,12 @@ - data - nginx/conf.d -- name: install docker +- name: install dependencies apt: force_apt_get: yes name: "{{ packages }}" vars: packages: - - docker.io - - docker-compose - openssl - name: Add users to docker group diff --git a/site.yaml b/site.yaml index 07a535e..b9944bb 100644 --- a/site.yaml +++ b/site.yaml @@ -11,5 +11,6 @@ - name: setup nextcloud instance hosts: nextcloud roles: + - { role: docker, become: yes } - { role: nextcloud, become: yes }