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