added nextcloud role

This commit is contained in:
2023-03-28 18:44:13 +02:00
parent 895bd3ab54
commit ff66bce50f
3 changed files with 85 additions and 1 deletions

View File

@@ -18,4 +18,11 @@
become: true become: true
roles: roles:
- npm - npm
tags: npm tags: npm
- name: Configure Nextcloud
hosts: nextcloud_hosts
become: true
roles:
- nextcloud
tags: nextcloud

View File

@@ -0,0 +1,66 @@
---
- name: Create Nextcloud directories if they do not exist
become: false
ansible.builtin.file:
path: /home/{{ user['name'] }}/docker/nextcloud/{{ item }}
state: directory
mode: '0755'
loop: '{{ nextcloud_folder }}'
- name: Create docker network 'nextcloud_internal'
community.docker.docker_network:
name: nextcloud_internal
- name: Create docker network 'proxy'
community.docker.docker_network:
name: proxy
- name: Create Nextcloud Maria-DB Container
community.docker.docker_container:
name: nextcloud_db
image: 'mariadb:latest'
state: started
restart_policy: unless-stopped
env:
MYSQL_ROOT_PASSWORD: "{{ NEXTCLOUD_MYSQL_ROOT_PASS | string }}"
MYSQL_DATABASE: "{{ NEXTCLOUD_MYSQL_DB | string }}"
MYSQL_USER: "{{ NEXTCLOUD_MYSQL_USER | string }}"
MYSQL_PASSWORD: "{{ NEXTCLOUD_MYSQL_PASS | string }}"
volumes:
- /home/{{ user['name'] }}/docker/nextcloud/db:/var/lib/mysql
networks:
- name: nextcloud_internal
- name: Create Nextcloud Redis Container
community.docker.docker_container:
name: nextcloud_redis
image: 'redis:alpine:latest'
state: started
restart_policy: unless-stopped
volumes:
- /home/{{ user['name'] }}/docker/nextcloud/redis:/var/lib/redis
networks:
- name: nextcloud_internal
- name: Create Nextcloud Container
community.docker.docker_container:
name: nextcloud_app
image: 'nextcloud:latest'
pull: yes
state: started
restart_policy: unless-stopped
ports:
- '11000:80'
env:
DB_MYSQL_HOST: "{{ NEXTCLOUD_MYSQL_HOST | string }}"
DB_MYSQL_PORT: "{{ NEXTCLOUD_MYSQL_PORT | string }}"
DB_MYSQL_USER: "{{ NEXTCLOUD_MYSQL_USER | string }}"
DB_MYSQL_PASSWORD: "{{ NEXTCLOUD_MYSQL_PASS | string }}"
DB_MYSQL_NAME: "{{ NEXTCLOUD_MYSQL_DB | string }}"
REDIS_HOST: nextcloud_redis
volumes:
- /home/{{ user['name'] }}/docker/nextcloud/data:/data
networks:
- name: nextcloud_internal
- name: proxy

View File

@@ -0,0 +1,11 @@
npm_folder:
- data
- db
- redis
NPM_MYSQL_HOST: 'nextcloud_db'
NPM_MYSQL_PORT: '3306'
NPM_MYSQL_DB: nextcloud
NPM_MYSQL_USER: nextcloud
NPM_MYSQL_PASS: 'y%3U^n&&PPwEaS7HVmjPUfWqpvuC*UDn'
NPM_MYSQL_ROOT_PASS: 'fV$gUVdkwdrsL^&n4!^@@fX#W3Jpf4WM'