legacy-server-config/nextcloud/init.yml

54 lines
1.3 KiB
YAML
Raw Normal View History

2021-01-01 15:09:53 +00:00
---
- hosts: teier.eu
gather_facts: no
tasks:
2021-01-31 19:52:24 +00:00
- name: Install psycopg2
shell: pip install psycopg2-binary
2021-01-01 15:09:53 +00:00
- name: Create database for nextcloud
2021-01-17 16:37:14 +00:00
community.postgresql.postgresql_db:
2021-01-31 19:52:24 +00:00
login_host: 127.0.0.1
2021-01-17 16:37:14 +00:00
login_user: postgres
login_password: "{{ lookup('env', 'POSTGRES_PASSWORD') }}"
2021-01-01 15:09:53 +00:00
name: nextcloud
state: present
2021-01-17 16:37:14 +00:00
2021-01-01 15:09:53 +00:00
- name: Create database user for nextcloud
2021-01-31 19:52:24 +00:00
community.postgresql.postgresql_user:
login_host: 127.0.0.1
2021-01-17 16:37:14 +00:00
login_user: postgres
login_password: "{{ lookup('env', 'POSTGRES_PASSWORD') }}"
2021-01-01 15:09:53 +00:00
name: nextcloud
password: "{{ lookup('env', 'NEXTCLOUD_DB_PASSWORD') }}"
2021-01-17 16:37:14 +00:00
db: nextcloud
priv: 'ALL'
2021-01-01 15:09:53 +00:00
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:
2021-01-17 16:37:14 +00:00
NEXTCLOUD_DB_PASSWORD: "{{ lookup('env', 'NEXTCLOUD_DB_PASSWORD') }}"