aboutsummaryrefslogtreecommitdiff
path: root/roles/nextcloud/tasks/main.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/nextcloud/tasks/main.yaml')
-rw-r--r--roles/nextcloud/tasks/main.yaml63
1 files changed, 63 insertions, 0 deletions
diff --git a/roles/nextcloud/tasks/main.yaml b/roles/nextcloud/tasks/main.yaml
new file mode 100644
index 0000000..593bfa3
--- /dev/null
+++ b/roles/nextcloud/tasks/main.yaml
@@ -0,0 +1,63 @@
+# https://docs.nextcloud.com/server/19/admin_manual/configuration_server/config_sample_php_parameters.html#default-parameters
+# https://docs.nextcloud.com/server/19/admin_manual/configuration_server/caching_configuration.html#id2
+---
+
+- name: 'Create the nextcloud network'
+ community.docker.docker_network:
+ name: '{{ nextcloud_docker_network_name }}'
+
+- name: Make sure the Postgres container is created and running
+ community.docker.docker_container:
+ name: 'nextcloud-postgres'
+ image: 'postgres:14.1-alpine'
+ pull: true
+ state: 'started'
+ labels:
+ "flame.type": "application"
+ "flame.name": "{{ nextcloud_container_name | title }}"
+ "flame.url": "{{ nextcloud_dashboard_url }}"
+ "flame.icon": "custom"
+ env:
+ "PUID": '{{ nextcloud_uid }}'
+ "PGID": '{{ nextcloud_gid }}'
+ "TZ": '{{ nextcloud_tz }}'
+ "POSTGRES_DB": "{{ nextcloud_postgres_db }}"
+ "POSTGRES_USER": "{{ nextcloud_postgres_user }}"
+ "POSTGRES_PASSWORD": "{{ nextcloud_postgres_password }}"
+ volumes:
+ - '{{ nextcloud_data_root }}/postgres:/var/lib/postgresql/data'
+ restart_policy: 'unless-stopped'
+
+- name: 'Make sure the Redis container is created and running'
+ community.docker.docker_container:
+ name: 'nextcloud-redis'
+ image: 'redis:alpine'
+ pull: true
+ state: 'started'
+ restart_policy: 'unless-stopped'
+
+- name: 'Make sure the Nextcloud container is created and running'
+ community.docker.docker_container:
+ name: '{{ nextcloud_container_name }}'
+ image: 'ghcr.io/linuxserver/nextcloud:php8'
+ pull: true
+ state: 'started'
+ env:
+ "PUID": '{{ nextcloud_uid }}'
+ "PGID": '{{ nextcloud_gid }}'
+ "TZ": '{{ nextcloud_tz }}'
+ volumes:
+ - '{{ nextcloud_data_root }}/config:/config'
+ - '{{ nextcloud_data_root }}/data:/data'
+ ports:
+ - '{{ nextcloud_host_port }}:443'
+ restart_policy: unless-stopped
+
+- name: 'Add {{ nextcloud_container_name }} to the docker network'
+ community.docker.docker_network:
+ name: '{{ nextcloud_docker_network_name }}'
+ connected:
+ - '{{ nextcloud_container_name }}'
+ - '{{ nextcloud_container_name }}-postgres'
+ - '{{ nextcloud_container_name }}-redis'
+ appends: true