legacy-server-config/nextcloud/init.yml

50 lines
1.2 KiB
YAML

---
- hosts: teier.eu
gather_facts: no
tasks:
- name: Create database for nextcloud
community.postgresql.postgresql_db:
login_user: postgres
login_password: "{{ lookup('env', 'POSTGRES_PASSWORD') }}"
name: nextcloud
state: present
- name: Create database user for nextcloud
community.postgresql.postgresql_user::
login_user: postgres
login_password: "{{ lookup('env', 'POSTGRES_PASSWORD') }}"
name: nextcloud
password: "{{ lookup('env', 'NEXTCLOUD_DB_PASSWORD') }}"
db: nextcloud
priv: 'ALL'
state: present
- name: Check dc directory
stat:
path: /dc/nextcloud
register: nextcloud_dc_dir_stat
- name: Create nextcloud dc directory
file:
path: /dc/nextcloud
state: directory
mode: 0755
group: root
owner: root
when: nextcloud_dc_dir_stat.islnk is not defined
- name: Copy compose file
copy:
src: docker-compose.yml
dest: /dc/nextcloud
- name: Copy nginx conf
copy:
src: nginx.conf
dest: /dc/nextcloud
- name: Start nextcloud
shell: "cd /dc/nextcloud && docker-compose up -d"
environment:
NEXTCLOUD_DB_PASSWORD: "{{ lookup('env', 'NEXTCLOUD_DB_PASSWORD') }}"