Install Nextcloud Docker container
This commit is contained in:
parent
93ec159bbb
commit
38041b22f6
5
dev/host_vars/nextcloud.yml
Normal file
5
dev/host_vars/nextcloud.yml
Normal file
@ -0,0 +1,5 @@
|
||||
# nextcloud
|
||||
mariadb_version: latest
|
||||
nextcloud_name: nextcloud
|
||||
nextcloud_dbpass: password
|
||||
nextcloud_version: stable
|
10
dev/nextcloud.yml
Normal file
10
dev/nextcloud.yml
Normal file
@ -0,0 +1,10 @@
|
||||
- name: Install Nextcloud Server
|
||||
hosts: all
|
||||
become: true
|
||||
vars_files:
|
||||
- host_vars/nextcloud.yml
|
||||
roles:
|
||||
- ansible
|
||||
- base
|
||||
- docker
|
||||
- nextcloud
|
4
roles/nextcloud/defaults/main.yml
Normal file
4
roles/nextcloud/defaults/main.yml
Normal file
@ -0,0 +1,4 @@
|
||||
# nextcloud
|
||||
mariadb_name: mariadb
|
||||
nextcloud_dbname: nextcloud
|
||||
nextcloud_dbuser: nextcloud
|
35
roles/nextcloud/tasks/main.yml
Normal file
35
roles/nextcloud/tasks/main.yml
Normal file
@ -0,0 +1,35 @@
|
||||
- name: Start MariaDB container
|
||||
docker_container:
|
||||
name: "{{ mariadb_name }}"
|
||||
image: mariadb:{{ mariadb_version }}
|
||||
restart_policy: always
|
||||
volumes: mariadb:/var/lib/mysql
|
||||
env:
|
||||
MYSQL_RANDOM_ROOT_PASSWORD: "true"
|
||||
MYSQL_DATABASE: "{{ nextcloud_dbname }}"
|
||||
MYSQL_USER: "{{ nextcloud_dbuser }}"
|
||||
MYSQL_PASSWORD: "{{ nextcloud_dbpass }}"
|
||||
|
||||
- name: Start Nextcloud container
|
||||
docker_container:
|
||||
name: "{{ nextcloud_name }}"
|
||||
image: nextcloud:{{ nextcloud_version }}
|
||||
restart_policy: always
|
||||
volumes: nextcloud:/var/www/html
|
||||
ports: 80:80
|
||||
links: "{{ mariadb_name }}:mysql"
|
||||
env:
|
||||
MYSQL_HOST: mysql
|
||||
MYSQL_DATABASE: "{{ nextcloud_dbname }}"
|
||||
MYSQL_USER: "{{ nextcloud_dbuser }}"
|
||||
MYSQL_PASSWORD: "{{ nextcloud_dbpass }}"
|
||||
register: nextcloud_container
|
||||
|
||||
- name: Do Nextcloud database maintenance
|
||||
command: "docker exec --user www-data {{ nextcloud_name }} php {{ item }}"
|
||||
loop:
|
||||
- "occ maintenance:mode --on"
|
||||
- "occ db:add-missing-indices"
|
||||
- "occ db:convert-filecache-bigint"
|
||||
- "occ maintenance:mode --off"
|
||||
when: nextcloud_container.changed
|
Loading…
Reference in New Issue
Block a user