aboutsummaryrefslogtreecommitdiff
path: root/roles/nextcloud/tasks/main.yaml
blob: 7c3d0d725e9277a2eff6e4439f369f83c06cc2c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# 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'
    recreate: true
    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: 'lscr.io/linuxserver/nextcloud:25.0.4'
    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