Consolidated var naming and added install path variable. #1
2 changed files with 70 additions and 69 deletions
|
@ -1,35 +1,36 @@
|
|||
---
|
||||
# defaults file for nextcloud
|
||||
mariadb_root_password: changeme
|
||||
mysql_host: mysqldb
|
||||
mysql_database: nextcloud
|
||||
nextcloud_install_user: '{{ ansible_user }}' # This user must be present on the host
|
||||
nextcloud_install_path: '/home/{{ nextcloud_install_user }}'
|
||||
nextcloud_mariadb_root_password: changeme
|
||||
nextcloud_mysql_host: mysqldb
|
||||
nextcloud_mysql_database: nextcloud
|
||||
nextcloud_mariadb_user: nextcloud
|
||||
nextcloud_mariadb_password: nextcloud
|
||||
nextcloud_admin_user: admin
|
||||
nextcloud_admin_password: mynextcloud
|
||||
nextcloud_trusted_domains: localhost
|
||||
virtual_host: localhost
|
||||
letsencrypt_host:
|
||||
letsencrypt_email:
|
||||
docker_user: deploy
|
||||
smtp_host:
|
||||
smtp_secure:
|
||||
smtp_port: 25
|
||||
smtp_authtype: PLAIN
|
||||
smtp_name:
|
||||
smtp_password:
|
||||
mail_from_address:
|
||||
mail_domain:
|
||||
nextcloud_virtual_host: localhost
|
||||
nextcloud_letsencrypt_host:
|
||||
nextcloud_letsencrypt_email:
|
||||
nextcloud_smtp_host:
|
||||
nextcloud_smtp_secure:
|
||||
nextcloud_smtp_port: 25
|
||||
nextcloud_smtp_authtype: PLAIN
|
||||
nextcloud_smtp_name:
|
||||
nextcloud_smtp_password:
|
||||
nextcloud_mail_from_address:
|
||||
nextcloud_mail_domain:
|
||||
nextcloud_overwrite_cli_url:
|
||||
nextcloud_overwrite_host:
|
||||
nextcloud_overwrite_protocol:
|
||||
nextcloud_enable_restic_compose_backup: False
|
||||
restic_aws_access_key_id:
|
||||
restic_aws_secret_access_key:
|
||||
restic_repository:
|
||||
restic_password:
|
||||
restic_keep_daily: 7
|
||||
restic_keep_weekly: 4
|
||||
restic_keep_monthly: 12
|
||||
restic_keep_yearly: 3
|
||||
restic_cron_schedule: "0 1 * * *"
|
||||
nextcloud_restic_aws_access_key_id:
|
||||
nextcloud_restic_aws_secret_access_key:
|
||||
nextcloud_restic_repository:
|
||||
nextcloud_restic_password:
|
||||
nextcloud_restic_keep_daily: 7
|
||||
nextcloud_restic_keep_weekly: 4
|
||||
nextcloud_restic_keep_monthly: 12
|
||||
nextcloud_restic_keep_yearly: 3
|
||||
nextcloud_restic_cron_schedule: "0 1 * * *"
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
# tasks file for nextcloud
|
||||
- name: Ensure nextcloud config directory exists
|
||||
file:
|
||||
path: /home/{{ docker_user }}/nextcloud
|
||||
path: "{{ nextcloud_install_path }}/nextcloud"
|
||||
state: directory
|
||||
owner: '{{ docker_user }}'
|
||||
group: '{{ docker_user }}'
|
||||
owner: '{{ nextcloud_install_user }}'
|
||||
group: '{{ nextcloud_install_user }}'
|
||||
|
||||
- name: Provide docker-compose.yml
|
||||
template:
|
||||
src: templates/docker-compose.nextcloud.yml.j2
|
||||
dest: /home/{{ docker_user }}/nextcloud/docker-compose.yml
|
||||
owner: "{{ docker_user }}"
|
||||
group: "{{ docker_user }}"
|
||||
dest: "{{ nextcloud_install_path }}/nextcloud/docker-compose.yml"
|
||||
owner: "{{ nextcloud_install_user }}"
|
||||
group: "{{ nextcloud_install_user }}"
|
||||
mode: '0644'
|
||||
|
||||
- name: Output docker-compose.yml
|
||||
shell: cat /home/{{ docker_user }}/nextcloud/docker-compose.yml
|
||||
shell: cat {{ nextcloud_install_path }}/nextcloud/docker-compose.yml
|
||||
register: output
|
||||
|
||||
- debug:
|
||||
|
@ -24,73 +24,73 @@
|
|||
|
||||
- name: Provide database env vars
|
||||
copy:
|
||||
dest: /home/{{ docker_user }}/nextcloud/db.env
|
||||
owner: "{{ docker_user }}"
|
||||
group: "{{ docker_user }}"
|
||||
dest: "{{ nextcloud_install_path }}/nextcloud/db.env"
|
||||
owner: "{{ nextcloud_install_user }}"
|
||||
group: "{{ nextcloud_install_user }}"
|
||||
mode: '0640'
|
||||
content: |
|
||||
# See https://github.com/docker-library/mariadb/issues/262
|
||||
MYSQL_INITDB_SKIP_TZINFO=1
|
||||
MYSQL_ROOT_PASSWORD={{ mariadb_root_password }}
|
||||
MYSQL_DATABASE={{ mysql_database }}
|
||||
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
|
||||
copy:
|
||||
dest: /home/{{ docker_user }}/nextcloud/nextcloud.env
|
||||
owner: "{{ docker_user }}"
|
||||
group: "{{ docker_user }}"
|
||||
dest: "{{ nextcloud_install_path }}/nextcloud/nextcloud.env"
|
||||
owner: "{{ nextcloud_install_user }}"
|
||||
group: "{{ nextcloud_install_user }}"
|
||||
mode: '0640'
|
||||
content: |
|
||||
VIRTUAL_HOST={{ virtual_host }}
|
||||
LETSENCRYPT_HOST={{ letsencrypt_host }}
|
||||
LETSENCRYPT_EMAIL={{ letsencrypt_email }}
|
||||
MYSQL_HOST={{ mysql_host }}
|
||||
MYSQL_DATABASE={{ mysql_database }}
|
||||
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={{ smtp_host }}
|
||||
SMTP_SECURE={{ smtp_secure }}
|
||||
SMTP_PORT={{ smtp_port }}
|
||||
SMTP_AUTHTYPE={{ smtp_authtype }}
|
||||
SMTP_NAME={{ smtp_name }}
|
||||
SMTP_PASSWORD={{ smtp_password }}
|
||||
MAIL_FROM_ADDRESS={{ mail_from_address }}
|
||||
MAIL_DOMAIN={{ mail_domain }}
|
||||
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
|
||||
copy:
|
||||
dest: /home/{{ docker_user }}/nextcloud/restic-compose-backup.env
|
||||
owner: "{{ docker_user }}"
|
||||
group: "{{ docker_user }}"
|
||||
dest: "{{ nextcloud_install_path }}/nextcloud/restic-compose-backup.env"
|
||||
owner: "{{ nextcloud_install_user }}"
|
||||
group: "{{ nextcloud_install_user }}"
|
||||
mode: '0640'
|
||||
content: |
|
||||
AWS_ACCESS_KEY_ID={{ restic_aws_access_key_id }}
|
||||
AWS_SECRET_ACCESS_KEY={{ restic_aws_secret_access_key }}
|
||||
RESTIC_REPOSITORY={{ restic_repository }}
|
||||
RESTIC_PASSWORD={{ restic_password }}
|
||||
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={{ restic_keep_daily}}
|
||||
RESTIC_KEEP_WEEKLY={{ restic_keep_weekly }}
|
||||
RESTIC_KEEP_MONTHLY={{ restic_keep_monthly }}
|
||||
RESTIC_KEEP_YEARLY={{ restic_keep_yearly }}
|
||||
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="{{ restic_cron_schedule }}"
|
||||
CRON_SCHEDULE="{{ nextcloud_restic_cron_schedule }}"
|
||||
when: nextcloud_enable_restic_compose_backup == true
|
||||
|
||||
- name: "docker-compose: Teardown existing Nextcloud service"
|
||||
docker_compose:
|
||||
project_src: "/home/{{ docker_user }}/nextcloud/"
|
||||
project_src: "{{ nextcloud_install_path }}/nextcloud/"
|
||||
state: absent
|
||||
tags: ['never', 'teardown']
|
||||
|
||||
- name: "docker-compose: Start Nextcloud service"
|
||||
docker_compose:
|
||||
project_src: "/home/{{ docker_user }}/nextcloud/"
|
||||
project_src: "{{ nextcloud_install_path }}/nextcloud/"
|
||||
register: output
|
||||
tags: service_start
|
||||
|
||||
|
@ -113,18 +113,18 @@
|
|||
|
||||
- name: "docker-compose: Set overwriteprotocol using occ"
|
||||
shell:
|
||||
chdir: /home/{{ docker_user }}/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 }}"'
|
||||
|
||||
- name: "docker-compose: Set overwrite.cli.url using occ"
|
||||
shell:
|
||||
chdir: /home/{{ docker_user }}/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 }}"'
|
||||
|
||||
- name: "docker-compose: Set overwritehost using occ"
|
||||
shell:
|
||||
cmd: docker-compose exec -T -u www-data nextcloud-app /bin/bash -c './occ config:system:set overwritehost --value="{{ nextcloud_overwrite_host }}"'
|
||||
chdir: /home/{{ docker_user }}/nextcloud/
|
||||
chdir: "{{ nextcloud_install_path }}/nextcloud/"
|
||||
|
||||
- name: "Test whether Nextcloud is healthy from the outside"
|
||||
when: not ansible_check_mode
|
||||
|
|
Loading…
Add table
Reference in a new issue