ansible-nas/roles/nextcloud/tasks/main.yml

52 lines
1.7 KiB
YAML
Raw Normal View History

2018-09-21 22:37:53 +00:00
---
- name: Create Nextcloud directories
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ nextcloud_data_directory }}/nextcloud"
- "{{ nextcloud_data_directory }}/mysql"
- name: Nextcloud Mysql Docker Container
docker_container:
name: nextcloud-mysql
image: mysql:5.7
pull: true
volumes:
- "{{ nextcloud_data_directory }}/mysql:/var/lib/mysql:rw"
env:
2019-07-03 22:00:56 +00:00
MYSQL_DATABASE: "nextcloud"
MYSQL_USER: "{{ nextcloud_sql_user }}"
2021-02-10 23:22:26 +00:00
MYSQL_PASSWORD: "{{ nextcloud_sql_password }}"
MYSQL_ROOT_PASSWORD: "{{ nextcloud_sql_root_password }}"
2018-09-21 22:37:53 +00:00
restart_policy: unless-stopped
memory: 1g
- name: Nextcloud Docker Container
docker_container:
name: nextcloud
image: nextcloud:14
pull: true
links:
- nextcloud-mysql:mysql
volumes:
- "{{ nextcloud_data_directory }}/nextcloud:/var/www/html:rw"
ports:
- "{{ nextcloud_port }}:80"
2018-09-21 22:37:53 +00:00
env:
2019-07-03 22:00:56 +00:00
MYSQL_HOST: "mysql"
MYSQL_DATABASE: "nextcloud"
MYSQL_USER: "{{ nextcloud_sql_user }}"
2021-02-10 23:22:26 +00:00
MYSQL_PASSWORD: "{{ nextcloud_sql_password }}"
NEXTCLOUD_TRUSTED_DOMAINS: "{{ nextcloud_hostname }}.{{ ansible_nas_domain }}"
restart_policy: unless-stopped
memory: 1g
labels:
traefik.enable: "{{ nextcloud_available_externally }}"
2021-01-19 17:18:12 +00:00
traefik.http.routers.nextcloud.rule: "Host(`{{ nextcloud_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.nextcloud.tls.certresolver: "letsencrypt"
traefik.http.routers.nextcloud.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.nextcloud.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.nextcloud.loadbalancer.server.port: "80"