40 lines
1.3 KiB
YAML
40 lines
1.3 KiB
YAML
---
|
|
- name: "Richte MariaDB-Datenbank ein"
|
|
when: item.database_type == "mariadb"
|
|
block:
|
|
- name: "Database | Erstelle Datenbank | {{ item.name }}"
|
|
community.mysql.mysql_db:
|
|
name: "{{ item.database }}"
|
|
state: present
|
|
login_unix_socket: "{{ mysql_socket }}"
|
|
login_user: root
|
|
|
|
- name: "Database | Richte Datenbank-Benutzer ein | {{ item.name }}"
|
|
community.mysql.mysql_user:
|
|
name: "{{ item.database }}"
|
|
host: "{{ inventory_hostname }}"
|
|
password: "{{ nextcloud_db_password }}"
|
|
priv: "{{ item.database }}.*:ALL"
|
|
state: present
|
|
login_unix_socket: "{{ mysql_socket }}"
|
|
login_user: root
|
|
update_password: on_create
|
|
|
|
- name: "Richte PostgreSQL-Datenbank ein"
|
|
when: item.database_type == "PostgreSQL"
|
|
block:
|
|
- name: "Database | Richte Datenbank-Benutzer ein | {{ item.name }}"
|
|
community.postgresql.postgresql_user:
|
|
name: "{{ item.database }}"
|
|
password: "{{ nextcloud_db_password }}"
|
|
become: true
|
|
become_user: postgres
|
|
|
|
- name: "Database | Erstelle Datenbank | {{ item.name }}"
|
|
community.postgresql.postgresql_db:
|
|
name: "{{ item.database }}"
|
|
owner: "{{ item.database }}"
|
|
encoding: UTF8
|
|
template: template0
|
|
become: true
|
|
become_user: postgres
|