ansible-role-nextcloud/tasks/main.yml

43 lines
1.5 KiB
YAML

---
#- name: Nextcloud | Assert all secrets have been configured.
# ansible.builtin.assert:
# that:
# - nextcloud_config.NEXTCLOUD_ADMIN_PASSWORD is defined
# - nextcloud_config.NEXTCLOUD_ADMIN_PASSWORD | length > 0
# fail_msg: "NEXTCLOUD_ADMIN_PASSWORD is not configured"
# quiet: true
# no_log: true
- name: Ensure that only one database backend is defined
ansible.builtin.assert:
that:
- "'{{ [nextcloud_config.SQLITE_DATABASE is defined,
nextcloud_config.POSTGRES_PASSWORD is defined,
nextcloud_config.MYSQL_PASSWORD is defined]
| select('equalto', true)
| list
| count }}' == '1'"
fail_msg: "Only one of SQLITE_DATABASE, POSTGRES_PASS or MYSQL_PASSWORD should be defined"
no_log: true
- name: Nextcloud | Create volumes
containers.podman.podman_volume:
state: present
name: "{{ item }}"
recreate: no
debug: no
loop: "{{ nextcloud_create_volumes }}"
# https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/with-nginx-proxy/mariadb/fpm/docker-compose.yml
- name: Nextcloud | Create container
containers.podman.podman_container:
debug: no
conmon_pidfile: "{{ nextcloud_pidfile }}"
image: "{{ nextcloud_image }}:{{ nextcloud_version }}"
image_strict: yes
recreate: yes
state: started
name: "{{ nextcloud_name }}"
env: "{{ nextcloud_config }}"
volume: "{{ nextcloud_volumes }}"
ports: "{{ nextcloud_ports }}"