Fixed file permissions and multitenancy feature (manually tested).
This commit is contained in:
parent
4992e21ecf
commit
520ee33b0e
16 changed files with 68 additions and 54 deletions
0
LICENSE
Normal file → Executable file
0
LICENSE
Normal file → Executable file
0
README.md
Normal file → Executable file
0
README.md
Normal file → Executable file
2
defaults/main.yml
Normal file → Executable file
2
defaults/main.yml
Normal file → Executable file
|
@ -10,8 +10,8 @@ nextcloud_mariadb_user: nextcloud
|
||||||
nextcloud_mariadb_password: nextcloud
|
nextcloud_mariadb_password: nextcloud
|
||||||
nextcloud_admin_user: admin
|
nextcloud_admin_user: admin
|
||||||
nextcloud_admin_password: mynextcloud
|
nextcloud_admin_password: mynextcloud
|
||||||
nextcloud_trusted_domains: localhost
|
|
||||||
nextcloud_virtual_host: localhost
|
nextcloud_virtual_host: localhost
|
||||||
|
nextcloud_trusted_domains: "localhost {{ ansible_host }} {{ nextcloud_virtual_host }}"
|
||||||
nextcloud_letsencrypt_host:
|
nextcloud_letsencrypt_host:
|
||||||
nextcloud_letsencrypt_email:
|
nextcloud_letsencrypt_email:
|
||||||
nextcloud_smtp_host:
|
nextcloud_smtp_host:
|
||||||
|
|
0
files/docker/proxy/Dockerfile
Normal file → Executable file
0
files/docker/proxy/Dockerfile
Normal file → Executable file
0
files/docker/proxy/uploadsize.conf
Normal file → Executable file
0
files/docker/proxy/uploadsize.conf
Normal file → Executable file
0
handlers/main.yml
Normal file → Executable file
0
handlers/main.yml
Normal file → Executable file
0
meta/main.yml
Normal file → Executable file
0
meta/main.yml
Normal file → Executable file
71
tasks/main.yml
Normal file → Executable file
71
tasks/main.yml
Normal file → Executable file
|
@ -22,64 +22,41 @@
|
||||||
- debug:
|
- debug:
|
||||||
var: output
|
var: output
|
||||||
|
|
||||||
|
- name: Provide compose project env vars
|
||||||
|
template:
|
||||||
|
src: templates/env.j2
|
||||||
|
dest: "{{ nextcloud_install_path }}/nextcloud/.env"
|
||||||
|
owner: "{{ nextcloud_install_user }}"
|
||||||
|
group: "{{ nextcloud_install_user }}"
|
||||||
|
mode: '0640'
|
||||||
|
tags: config
|
||||||
|
|
||||||
- name: Provide database env vars
|
- name: Provide database env vars
|
||||||
copy:
|
template:
|
||||||
|
src: templates/db.env.j2
|
||||||
dest: "{{ nextcloud_install_path }}/nextcloud/db.env"
|
dest: "{{ nextcloud_install_path }}/nextcloud/db.env"
|
||||||
owner: "{{ nextcloud_install_user }}"
|
owner: "{{ nextcloud_install_user }}"
|
||||||
group: "{{ nextcloud_install_user }}"
|
group: "{{ nextcloud_install_user }}"
|
||||||
mode: '0640'
|
mode: '0640'
|
||||||
content: |
|
tags: config
|
||||||
# See https://github.com/docker-library/mariadb/issues/262
|
|
||||||
MYSQL_INITDB_SKIP_TZINFO=1
|
|
||||||
MYSQL_ROOT_PASSWORD={{ nextcloud_mariadb_root_password }}
|
|
||||||
MYSQL_DATABASE={{ nextcloud_mysql_database }}
|
|
||||||
MYSQL_PASSWORD={{ nextcloud_mariadb_password }}
|
|
||||||
MYSQL_USER={{ nextcloud_mariadb_user }}
|
|
||||||
|
|
||||||
- name: Provide Nextcloud env vars
|
- name: Provide Nextcloud env vars
|
||||||
copy:
|
template:
|
||||||
|
src: templates/nextcloud.env.j2
|
||||||
dest: "{{ nextcloud_install_path }}/nextcloud/nextcloud.env"
|
dest: "{{ nextcloud_install_path }}/nextcloud/nextcloud.env"
|
||||||
owner: "{{ nextcloud_install_user }}"
|
owner: "{{ nextcloud_install_user }}"
|
||||||
group: "{{ nextcloud_install_user }}"
|
group: "{{ nextcloud_install_user }}"
|
||||||
mode: '0640'
|
mode: '0640'
|
||||||
content: |
|
tags: config
|
||||||
VIRTUAL_HOST={{ nextcloud_virtual_host }}
|
|
||||||
LETSENCRYPT_HOST={{ nextcloud_letsencrypt_host }}
|
|
||||||
LETSENCRYPT_EMAIL={{ nextcloud_letsencrypt_email }}
|
|
||||||
MYSQL_HOST={{ nextcloud_mysql_host }}
|
|
||||||
MYSQL_DATABASE={{ nextcloud_mysql_database }}
|
|
||||||
MYSQL_PASSWORD={{ nextcloud_mariadb_password }}
|
|
||||||
MYSQL_USER={{ nextcloud_mariadb_user }}
|
|
||||||
NEXTCLOUD_ADMIN_USER={{ nextcloud_admin_user }}
|
|
||||||
NEXTCLOUD_ADMIN_PASSWORD={{ nextcloud_admin_password }}
|
|
||||||
NEXTCLOUD_TRUSTED_DOMAINS={{ nextcloud_trusted_domains }}
|
|
||||||
SMTP_HOST={{ nextcloud_smtp_host }}
|
|
||||||
SMTP_SECURE={{ nextcloud_smtp_secure }}
|
|
||||||
SMTP_PORT={{ nextcloud_smtp_port }}
|
|
||||||
SMTP_AUTHTYPE={{ nextcloud_smtp_authtype }}
|
|
||||||
SMTP_NAME={{ nextcloud_smtp_name }}
|
|
||||||
SMTP_PASSWORD={{ nextcloud_smtp_password }}
|
|
||||||
MAIL_FROM_ADDRESS={{ nextcloud_mail_from_address }}
|
|
||||||
MAIL_DOMAIN={{ nextcloud_mail_domain }}
|
|
||||||
|
|
||||||
- name: Provide restic-compose-backup env vars
|
- name: Provide restic-compose-backup env vars
|
||||||
copy:
|
template:
|
||||||
|
src: templates/restic-compose-backup.env.j2
|
||||||
dest: "{{ nextcloud_install_path }}/nextcloud/restic-compose-backup.env"
|
dest: "{{ nextcloud_install_path }}/nextcloud/restic-compose-backup.env"
|
||||||
owner: "{{ nextcloud_install_user }}"
|
owner: "{{ nextcloud_install_user }}"
|
||||||
group: "{{ nextcloud_install_user }}"
|
group: "{{ nextcloud_install_user }}"
|
||||||
mode: '0640'
|
mode: '0640'
|
||||||
content: |
|
tags: config
|
||||||
AWS_ACCESS_KEY_ID={{ nextcloud_restic_aws_access_key_id }}
|
|
||||||
AWS_SECRET_ACCESS_KEY={{ nextcloud_restic_aws_secret_access_key }}
|
|
||||||
RESTIC_REPOSITORY={{ nextcloud_restic_repository }}
|
|
||||||
RESTIC_PASSWORD={{ nextcloud_restic_password }}
|
|
||||||
# snapshot prune rules
|
|
||||||
RESTIC_KEEP_DAILY={{ nextcloud_restic_keep_daily}}
|
|
||||||
RESTIC_KEEP_WEEKLY={{ nextcloud_restic_keep_weekly }}
|
|
||||||
RESTIC_KEEP_MONTHLY={{ nextcloud_restic_keep_monthly }}
|
|
||||||
RESTIC_KEEP_YEARLY={{ nextcloud_restic_keep_yearly }}
|
|
||||||
# Cron schedule. Run every day at 1am
|
|
||||||
CRON_SCHEDULE="{{ nextcloud_restic_cron_schedule }}"
|
|
||||||
when: nextcloud_enable_restic_compose_backup == true
|
when: nextcloud_enable_restic_compose_backup == true
|
||||||
|
|
||||||
- name: "docker-compose: Teardown existing Nextcloud service"
|
- name: "docker-compose: Teardown existing Nextcloud service"
|
||||||
|
@ -99,11 +76,11 @@
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- "output.ansible_facts['nextcloud-app']['nextcloud-app'].state.running"
|
- "output.ansible_facts['nextcloud-app']['nextcloud{{ nextcloud_multitenant_postfix }}_nextcloud-app_1'].state.running"
|
||||||
|
|
||||||
- name: Get container IP
|
- name: "Get container IP"
|
||||||
set_fact:
|
set_fact:
|
||||||
nextcloud_ip: "{{ output.ansible_facts['nextcloud-app']['nextcloud-app'].networks.nextcloud_default.IPAddress }}"
|
nextcloud_ip: "{{ output.ansible_facts['nextcloud-app']['nextcloud' + nextcloud_multitenant_postfix + '_nextcloud-app_1'].networks['nextcloud' + nextcloud_multitenant_postfix + '_default'].IPAddress }}"
|
||||||
|
|
||||||
- name: "Waiting for Nextcloud container to become available"
|
- name: "Waiting for Nextcloud container to become available"
|
||||||
become: false
|
become: false
|
||||||
|
@ -114,16 +91,16 @@
|
||||||
- name: "docker-compose: Set overwriteprotocol using occ"
|
- name: "docker-compose: Set overwriteprotocol using occ"
|
||||||
shell:
|
shell:
|
||||||
chdir: "{{ nextcloud_install_path }}/nextcloud/"
|
chdir: "{{ nextcloud_install_path }}/nextcloud/"
|
||||||
cmd: docker-compose exec -T -u www-data nextcloud-app /bin/bash -c './occ config:system:set overwriteprotocol --value="{{ nextcloud_overwrite_protocol }}"'
|
cmd: docker-compose exec -T -u www-data nextcloud{{ nextcloud_multitenant_postfix }}_nextcloud-app_1 /bin/bash -c './occ config:system:set overwriteprotocol --value="{{ nextcloud_overwrite_protocol }}"'
|
||||||
|
|
||||||
- name: "docker-compose: Set overwrite.cli.url using occ"
|
- name: "docker-compose: Set overwrite.cli.url using occ"
|
||||||
shell:
|
shell:
|
||||||
chdir: "{{ nextcloud_install_path }}/nextcloud/"
|
chdir: "{{ nextcloud_install_path }}/nextcloud/"
|
||||||
cmd: docker-compose exec -T -u www-data nextcloud-app /bin/bash -c './occ config:system:set overwrite.cli.url --value="{{ nextcloud_overwrite_cli_url }}"'
|
cmd: docker-compose exec -T -u www-data nextcloud{{ nextcloud_multitenant_postfix }}_nextcloud-app_1 /bin/bash -c './occ config:system:set overwrite.cli.url --value="{{ nextcloud_overwrite_cli_url }}"'
|
||||||
|
|
||||||
- name: "docker-compose: Set overwritehost using occ"
|
- name: "docker-compose: Set overwritehost using occ"
|
||||||
shell:
|
shell:
|
||||||
cmd: docker-compose exec -T -u www-data nextcloud-app /bin/bash -c './occ config:system:set overwritehost --value="{{ nextcloud_overwrite_host }}"'
|
cmd: docker-compose exec -T -u www-data nextcloud{{ nextcloud_multitenant_postfix }}_nextcloud-app_1 /bin/bash -c './occ config:system:set overwritehost --value="{{ nextcloud_overwrite_host }}"'
|
||||||
chdir: "{{ nextcloud_install_path }}/nextcloud/"
|
chdir: "{{ nextcloud_install_path }}/nextcloud/"
|
||||||
|
|
||||||
- name: "Test whether Nextcloud is healthy from the outside"
|
- name: "Test whether Nextcloud is healthy from the outside"
|
||||||
|
|
6
templates/db.env.j2
Executable file
6
templates/db.env.j2
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
# See https://github.com/docker-library/mariadb/issues/262
|
||||||
|
MYSQL_INITDB_SKIP_TZINFO=1
|
||||||
|
MYSQL_ROOT_PASSWORD={{ nextcloud_mariadb_root_password }}
|
||||||
|
MYSQL_DATABASE={{ nextcloud_mysql_database }}
|
||||||
|
MYSQL_PASSWORD={{ nextcloud_mariadb_password }}
|
||||||
|
MYSQL_USER={{ nextcloud_mariadb_user }}
|
6
templates/docker-compose.nextcloud.yml.j2
Normal file → Executable file
6
templates/docker-compose.nextcloud.yml.j2
Normal file → Executable file
|
@ -8,8 +8,6 @@ networks:
|
||||||
services:
|
services:
|
||||||
mysqldb:
|
mysqldb:
|
||||||
image: mariadb:10.4.11
|
image: mariadb:10.4.11
|
||||||
container_name: mysqldb{{ nextcloud_multitenant_postfix }}
|
|
||||||
hostname: mysqldb{{ nextcloud_multitenant_postfix }}
|
|
||||||
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
|
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
|
||||||
volumes:
|
volumes:
|
||||||
- mysqldb{{ nextcloud_multitenant_postfix }}:/var/lib/mysql
|
- mysqldb{{ nextcloud_multitenant_postfix }}:/var/lib/mysql
|
||||||
|
@ -24,8 +22,6 @@ services:
|
||||||
|
|
||||||
nextcloud-app:
|
nextcloud-app:
|
||||||
image: nextcloud:apache
|
image: nextcloud:apache
|
||||||
container_name: nextcloud-app{{ nextcloud_multitenant_postfix }}
|
|
||||||
hostname: nextcloud-app{{ nextcloud_multitenant_postfix }}
|
|
||||||
networks:
|
networks:
|
||||||
- public
|
- public
|
||||||
- default
|
- default
|
||||||
|
@ -67,8 +63,6 @@ services:
|
||||||
# The backup service
|
# The backup service
|
||||||
backup:
|
backup:
|
||||||
image: zettaio/restic-compose-backup:0.4.2
|
image: zettaio/restic-compose-backup:0.4.2
|
||||||
container_name: backup{{ nextcloud_multitenant_postfix }}
|
|
||||||
hostname: backup{{ nextcloud_multitenant_postfix }}
|
|
||||||
env_file:
|
env_file:
|
||||||
- restic-compose-backup.env
|
- restic-compose-backup.env
|
||||||
volumes:
|
volumes:
|
||||||
|
|
5
templates/env.j2
Executable file
5
templates/env.j2
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#
|
||||||
|
# Docker Compose configuration
|
||||||
|
#
|
||||||
|
# Project name for this Docker Compose setup
|
||||||
|
COMPOSE_PROJECT_NAME=nextcloud{{ nextcloud_multitenant_postfix }}
|
21
templates/nextcloud.env.j2
Executable file
21
templates/nextcloud.env.j2
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
# See https://github.com/nextcloud/docker/ for available env vars
|
||||||
|
VIRTUAL_HOST={{ nextcloud_virtual_host }}
|
||||||
|
LETSENCRYPT_HOST={{ nextcloud_letsencrypt_host }}
|
||||||
|
LETSENCRYPT_EMAIL={{ nextcloud_letsencrypt_email }}
|
||||||
|
MYSQL_HOST={{ nextcloud_mysql_host }}
|
||||||
|
MYSQL_DATABASE={{ nextcloud_mysql_database }}
|
||||||
|
MYSQL_PASSWORD={{ nextcloud_mariadb_password }}
|
||||||
|
MYSQL_USER={{ nextcloud_mariadb_user }}
|
||||||
|
NEXTCLOUD_ADMIN_USER={{ nextcloud_admin_user }}
|
||||||
|
NEXTCLOUD_ADMIN_PASSWORD={{ nextcloud_admin_password }}
|
||||||
|
NEXTCLOUD_TRUSTED_DOMAINS={{ nextcloud_trusted_domains }}
|
||||||
|
OVERWRITEPROTOCOL=https
|
||||||
|
OVERWRITECLIURL=https://{{ nextcloud_virtual_host }}
|
||||||
|
SMTP_HOST={{ nextcloud_smtp_host }}
|
||||||
|
SMTP_SECURE={{ nextcloud_smtp_secure }}
|
||||||
|
SMTP_PORT={{ nextcloud_smtp_port }}
|
||||||
|
SMTP_AUTHTYPE={{ nextcloud_smtp_authtype }}
|
||||||
|
SMTP_NAME={{ nextcloud_smtp_name }}
|
||||||
|
SMTP_PASSWORD={{ nextcloud_smtp_password }}
|
||||||
|
MAIL_FROM_ADDRESS={{ nextcloud_mail_from_address }}
|
||||||
|
MAIL_DOMAIN={{ nextcloud_mail_domain }}
|
11
templates/restic-compose-backup.env.j2
Executable file
11
templates/restic-compose-backup.env.j2
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
AWS_ACCESS_KEY_ID={{ nextcloud_restic_aws_access_key_id }}
|
||||||
|
AWS_SECRET_ACCESS_KEY={{ nextcloud_restic_aws_secret_access_key }}
|
||||||
|
RESTIC_REPOSITORY={{ nextcloud_restic_repository }}
|
||||||
|
RESTIC_PASSWORD={{ nextcloud_restic_password }}
|
||||||
|
# snapshot prune rules
|
||||||
|
RESTIC_KEEP_DAILY={{ nextcloud_restic_keep_daily}}
|
||||||
|
RESTIC_KEEP_WEEKLY={{ nextcloud_restic_keep_weekly }}
|
||||||
|
RESTIC_KEEP_MONTHLY={{ nextcloud_restic_keep_monthly }}
|
||||||
|
RESTIC_KEEP_YEARLY={{ nextcloud_restic_keep_yearly }}
|
||||||
|
# Cron schedule. Run every day at 1am
|
||||||
|
CRON_SCHEDULE="{{ nextcloud_restic_cron_schedule }}"
|
0
tests/inventory
Normal file → Executable file
0
tests/inventory
Normal file → Executable file
0
tests/test.yml
Normal file → Executable file
0
tests/test.yml
Normal file → Executable file
0
vars/main.yml
Normal file → Executable file
0
vars/main.yml
Normal file → Executable file
Loading…
Add table
Reference in a new issue