Enable PostgreSQL database support
This commit is contained in:
parent
2a03876360
commit
86aef332ca
4 changed files with 55 additions and 18 deletions
|
@ -34,6 +34,7 @@ nextcloud_instances:
|
|||
- name: coop.systemausfall.org
|
||||
user: nextcloud
|
||||
database: nextcloud
|
||||
database_type: PostgreSQL
|
||||
hiddenservice: true
|
||||
occ_config:
|
||||
apps:
|
||||
|
@ -65,7 +66,8 @@ php_cli_config:
|
|||
| `name` | string | Domain-Name der Instanz |
|
||||
| `alias`| string | Array mit weiteren Domain-Alias-Namen für diese Instanz |
|
||||
| `user` | string | Name eines anzulegenden Systemnutzers, der den PHP-FPM-Prozess ausführt |
|
||||
| `database` | string | Name der anzulegenden MariaDB-Datenbank |
|
||||
| `database` | string | Name der anzulegenden Datenbank |
|
||||
| `database_type` | string | `MariaDB` oder `PostgreSQL` |
|
||||
| `hiddenservice` | bol | Richtet für die Instanz einen Onion Service ein |
|
||||
- Starte anschließend das Playbook:
|
||||
```Shell
|
||||
|
|
|
@ -4,6 +4,7 @@ apache_custom_conf_path: /etc/apache2/conf-available
|
|||
nextcloud_admin_user: systemausfall.org
|
||||
nextcloud_admin_pw: "{{ lookup('password', '/tmp/{{ item.name }}_admin_pwd length=42 chars=ascii_letters,digits') }}"
|
||||
nextcloud_db_password: "{{ lookup('password', '/tmp/{{ item.name }}_db_pwd length=42 chars=ascii_letters,digits') }}"
|
||||
nextcloud_db_type: MariaDB
|
||||
nextcloud_github_api_url: https://api.github.com/repos/nextcloud/server/releases/latest
|
||||
nextcloud_dl_url: "https://download.nextcloud.com/server/releases/nextcloud-{{ latest_version.stdout }}.tar.bz2"
|
||||
nextcloud_root: /data/nextcloud
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
---
|
||||
- name: "Richte MariaDB-Datenbank ein"
|
||||
when: item.database_type == "MariaDB"
|
||||
block:
|
||||
- name: "Database | Erstelle Datenbank | {{ item.name }}"
|
||||
community.mysql.mysql_db:
|
||||
name: "{{ item.database }}"
|
||||
|
@ -16,3 +19,22 @@
|
|||
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
|
||||
|
|
|
@ -47,4 +47,16 @@
|
|||
become: true
|
||||
become_user: "{{ item.user }}"
|
||||
changed_when: true
|
||||
when: not nc_is_installed.stat.exists
|
||||
when: not nc_is_installed.stat.exists and item.database_type == "MariaDB"
|
||||
|
||||
- name: "Nextcloud | Führe Installation aus | {{ item.name }}"
|
||||
ansible.builtin.command:
|
||||
cmd: >
|
||||
php occ maintenance:install --database "pgsql"
|
||||
--database-name "{{ item.database }}" --database-user "{{ item.database }}"
|
||||
--database-pass "{{ nextcloud_db_password }}" --database-host "{{ database_host }}"
|
||||
--admin-user "{{ nextcloud_admin_user }}" --admin-pass "{{ nextcloud_admin_pw }}"
|
||||
chdir: "{{ nextcloud_install_path }}"
|
||||
become: true
|
||||
become_user: "{{ item.user }}"
|
||||
when: not nc_is_installed.stat.exists and item.database_type == "PostgreSQL"
|
||||
|
|
Loading…
Reference in a new issue