32fe016c40
* added optional systemd service + timer for nextcloud app updates * added optional systemd service + timer for nextcloud app updates * added uninstall tasks
116 lines
4.2 KiB
YAML
116 lines
4.2 KiB
YAML
---
|
|
|
|
- name: Ensure Nextcloud paths exists
|
|
ansible.builtin.file:
|
|
path: "{{ item.path }}"
|
|
state: "{{ item.state }}"
|
|
mode: 0700
|
|
owner: "{{ nextcloud_uid }}"
|
|
group: "{{ nextcloud_gid }}"
|
|
with_items:
|
|
- path: "{{ nextcloud_base_path }}"
|
|
state: directory
|
|
when: true
|
|
- path: "{{ nextcloud_config_path }}"
|
|
state: directory
|
|
when: true
|
|
- path: "{{ nextcloud_data_path }}"
|
|
state: directory
|
|
when: true
|
|
- path: "{{ nextcloud_customized_container_src_path }}"
|
|
state: directory
|
|
when: "{{ nextcloud_container_image_customizations_enabled }}"
|
|
- path: "{{ nextcloud_redis_session_ini_path }}"
|
|
state: "{{ 'touch' if nextcloud_redis_is_configured else 'absent' }}"
|
|
when: true
|
|
- path: "{{ nextcloud_preview_host_folder }}"
|
|
state: "{{ 'directory' if nextcloud_preview_enabled else 'absent' }}"
|
|
when: true
|
|
when: item.when | bool
|
|
|
|
- name: Ensure Nextcloud support files installed
|
|
ansible.builtin.template:
|
|
src: "{{ role_path }}/templates/{{ item }}.j2"
|
|
dest: "{{ nextcloud_config_path }}/{{ item }}"
|
|
mode: 0640
|
|
with_items:
|
|
- env
|
|
- labels
|
|
|
|
- when: "nextcloud_preview_enabled | bool"
|
|
name: Ensure Nextcloud preview generator files are present
|
|
ansible.builtin.template:
|
|
src: "{{ role_path }}/templates/preview-generator/{{ item }}.j2"
|
|
dest: "{{ nextcloud_preview_host_folder }}/{{ item }}"
|
|
mode: 0740
|
|
with_items:
|
|
- preview-generator-cron.sh
|
|
|
|
- name: Ensure Nextcloud container image is pulled
|
|
community.docker.docker_image:
|
|
name: "{{ nextcloud_container_image }}"
|
|
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
|
force_source: "{{ nextcloud_container_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
|
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else nextcloud_container_image_force_pull }}"
|
|
register: result
|
|
retries: "{{ devture_playbook_help_container_retries_count }}"
|
|
delay: "{{ devture_playbook_help_container_retries_delay }}"
|
|
until: result is not failed
|
|
|
|
- when: "nextcloud_container_image_customizations_enabled | bool"
|
|
block:
|
|
- name: Ensure customizations Dockerfile is created
|
|
ansible.builtin.template:
|
|
src: "{{ role_path }}/templates/customizations/Dockerfile.j2"
|
|
dest: "{{ nextcloud_customized_container_src_path }}/Dockerfile"
|
|
owner: "{{ nextcloud_uid }}"
|
|
group: "{{ nextcloud_gid }}"
|
|
mode: 0640
|
|
register: nextcloud_container_image_customizations_dockerfile_result
|
|
|
|
- name: Ensure customized container image for Nextcloud is built
|
|
community.docker.docker_image:
|
|
name: "{{ nextcloud_container_image_customized }}"
|
|
source: build
|
|
force_source: "{{ nextcloud_container_image_customizations_dockerfile_result.changed }}"
|
|
build:
|
|
dockerfile: Dockerfile
|
|
path: "{{ nextcloud_customized_container_src_path }}"
|
|
pull: true
|
|
|
|
- name: Ensure Nextcloud container network is created
|
|
community.general.docker_network:
|
|
name: "{{ nextcloud_container_network }}"
|
|
driver: bridge
|
|
|
|
- name: Ensure Nextcloud systemd services installed
|
|
ansible.builtin.template:
|
|
src: "{{ role_path }}/templates/systemd/{{ item }}.j2"
|
|
dest: "{{ devture_systemd_docker_base_systemd_path }}/{{ nextcloud_identifier }}-{{ item }}"
|
|
mode: 0640
|
|
with_items:
|
|
- server.service
|
|
- cron.service
|
|
- cron.timer
|
|
|
|
- when: "nextcloud_auto_app_update_enabled | bool"
|
|
block:
|
|
- name: Ensure Nextcloud app update systemd services installed
|
|
ansible.builtin.template:
|
|
src: "{{ role_path }}/templates/systemd/{{ item }}.j2"
|
|
dest: "{{ devture_systemd_docker_base_systemd_path }}/{{ nextcloud_identifier }}-{{ item }}"
|
|
mode: 0640
|
|
with_items:
|
|
- app-update.service
|
|
- app-update.timer
|
|
|
|
- when: "not nextcloud_auto_app_update_enabled | bool"
|
|
block:
|
|
- name: Ensure Nextcloud systemd app update services do not exists
|
|
ansible.builtin.file:
|
|
path: "{{ devture_systemd_docker_base_systemd_path }}/{{ nextcloud_identifier }}-{{ item }}"
|
|
state: absent
|
|
with_items:
|
|
- app-update.service
|
|
- app-update.timer
|
|
|