2024-10-23 13:51:59 +05:00
|
|
|
---
|
|
|
|
- name: Create docker volume
|
|
|
|
become: true
|
|
|
|
community.docker.docker_volume:
|
|
|
|
name: nextcloud
|
|
|
|
- name: Create redis container
|
|
|
|
include_role:
|
|
|
|
name: redis
|
|
|
|
vars:
|
|
|
|
preset: persistent
|
|
|
|
container_name: nextcloud-redis
|
|
|
|
docker_networks:
|
|
|
|
- name: nextcloud
|
|
|
|
docker_volume: nextcloud-redis
|
|
|
|
- name: Copy nextcloud config
|
|
|
|
become: true
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: config.php.j2
|
|
|
|
dest: "/var/lib/docker/volumes/nextcloud/_data/config/config.php"
|
|
|
|
owner: "33"
|
|
|
|
group: "33"
|
|
|
|
register: cfg
|
|
|
|
- name: Run nextcloud container
|
|
|
|
become: true
|
|
|
|
community.docker.docker_container:
|
|
|
|
name: nextcloud-{{ item }}
|
|
|
|
image: nextcloud:{{ version }}-apache
|
|
|
|
networks:
|
|
|
|
- name: nextcloud
|
|
|
|
- name: haproxy
|
|
|
|
- name: postgresql
|
|
|
|
volumes:
|
|
|
|
- nextcloud:/var/www/html
|
|
|
|
- /mnt/hdd/nextcloud/data:/var/www/html/data
|
|
|
|
recreate: "{{ cfg.changed }}"
|
2024-10-30 17:55:20 +05:00
|
|
|
restart_policy: unless-stopped
|
2024-10-23 13:51:59 +05:00
|
|
|
loop: [1]
|
|
|
|
- name: Schedule background jobs
|
|
|
|
become: true
|
|
|
|
ansible.builtin.cron:
|
|
|
|
name: nextcloud
|
|
|
|
minute: "*/5"
|
|
|
|
job: "docker exec --user www-data nextcloud-1 php cron.php"
|
|
|
|
user: root
|