ansible-role-nextcloud/tasks/database.yml

41 lines
1.3 KiB
YAML
Raw Permalink Normal View History

2020-12-03 15:52:14 +01:00
---
2023-10-25 17:44:18 +02:00
- name: "Richte MariaDB-Datenbank ein"
2024-03-23 23:10:01 +01:00
when: item.database_type == "mariadb"
2023-10-25 17:44:18 +02:00
block:
- name: "Database | Erstelle Datenbank | {{ item.name }}"
community.mysql.mysql_db:
name: "{{ item.database }}"
state: present
login_unix_socket: "{{ mysql_socket }}"
login_user: root
2020-12-03 15:52:14 +01:00
2023-10-25 17:44:18 +02:00
- 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:
2023-10-25 21:16:02 +02:00
- name: "Database | Richte Datenbank-Benutzer ein | {{ item.name }}"
community.postgresql.postgresql_user:
2023-10-25 17:44:18 +02:00
name: "{{ item.database }}"
2023-10-25 21:16:02 +02:00
password: "{{ nextcloud_db_password }}"
2023-10-25 17:44:18 +02:00
become: true
become_user: postgres
2023-10-25 21:16:02 +02:00
- name: "Database | Erstelle Datenbank | {{ item.name }}"
community.postgresql.postgresql_db:
2023-10-25 17:44:18 +02:00
name: "{{ item.database }}"
2023-10-25 21:16:02 +02:00
owner: "{{ item.database }}"
encoding: UTF8
template: template0
2023-10-25 17:44:18 +02:00
become: true
become_user: postgres