ansible-role-nextcloud/tasks/database.yml

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 | Erstelle Datenbank | {{ item.name }}"
community.postgresql.postgresql_db:
name: "{{ item.database }}"
encoding: UTF8
template: template0
become: true
become_user: postgres
- name: "Database | Richte Datenbank-Benutzer ein | {{ item.name }}"
community.postgresql.postgresql_user:
name: "{{ item.database }}"
password: "{{ nextcloud_db_password }}"
db: "{{ item.database }}"
become: true
become_user: postgres