# vim: ft=yaml.ansible --- - name: Create Nextcloud volume directories file: name: "{{ services.nextcloud.volume }}/{{ dir.name }}" owner: "{{ dir.owner | default('root') }}" mode: u=rwx,g=rx,o=rx state: directory loop: - name: apache2 - name: data - name: db owner: '999' loop_control: loop_var: dir - name: Copy Apache2 config files copy: src: "nextcloud/apache2/{{ file }}" dest: "{{ services.nextcloud.volume }}/apache2/{{ file }}" owner: root mode: u=rw,g=r,o=r loop: - apache2.conf - remoteip.conf loop_control: loop_var: file - name: Deploy Nextcloud with Docker Compose docker_compose: project_name: nextcloud pull: true definition: version: '3.8' services: mysql: image: "mariadb:{{ services.nextcloud.mariadb_version }}" restart: unless-stopped command: - '--transaction-isolation=READ-COMMITTED' - --log-bin - '--binlog-format=ROW' - '--innodb_read_only_compressed=OFF' environment: MYSQL_DATABASE: nextcloud MYSQL_USER: nextcloud MYSQL_PASSWORD: "{{ secrets.nextcloud.mysql_pw }}" MYSQL_ROOT_PASSWORD: "{{ secrets.nextcloud.mysql_pw }}" volumes: - "{{ services.nextcloud.volume }}/db:/var/lib/mysql:rw" redis: image: "redis:{{ services.nextcloud.redis_version }}" restart: unless-stopped command: "redis-server --requirepass {{ secrets.nextcloud.redis_pw }}" tmpfs: - /var/lib/redis cron: image: "nextcloud:{{ services.nextcloud.version }}" restart: unless-stopped entrypoint: /cron.sh volumes: - "{{ services.nextcloud.volume }}/data:/var/www/html:rw" depends_on: - mysql - redis app: image: "nextcloud:{{ services.nextcloud.version }}" restart: unless-stopped environment: MYSQL_HOST: mysql MYSQL_DATABASE: nextcloud MYSQL_USER: nextcloud MYSQL_PASSWORD: "{{ secrets.nextcloud.mysql_pw }}" REDIS_HOST: redis REDIS_HOST_PASSWORD: "{{ secrets.nextcloud.redis_pw }}" PHP_MEMORY_LIMIT: 2G PHP_UPLOAD_LIMIT: 16G volumes: - "{{ services.nextcloud.volume }}/data:/var/www/html:rw" - "{{ services.nextcloud.volume }}/apache2/apache2.conf:/etc/apache2/apache2.conf:ro" - "{{ services.nextcloud.volume }}/apache2/remoteip.conf:/etc/apache2/conf-enabled/remoteip.conf:ro" ports: - '127.0.0.1:8080:80' depends_on: - mysql - redis