Просмотр исходного кода

Postgresql support and other improvements

master
Markus Katharina Brechtel 4 лет назад
Родитель
Сommit
296f081c43
8 измененных файлов: 62 добавлений и 6 удалений
  1. +3
    -1
      defaults/main.yml
  2. +3
    -2
      tasks/install.yml
  3. +3
    -0
      tasks/main.yml
  4. +2
    -2
      tasks/mysql.yml
  5. +26
    -0
      tasks/postgresql.yaml
  6. +15
    -1
      tasks/reset.yml
  7. +2
    -0
      tasks/setup_Debian.yml
  8. +8
    -0
      vars/main.yml

+ 3
- 1
defaults/main.yml Просмотреть файл

@@ -28,6 +28,8 @@ nextcloud_server_names:

nextcloud_force_downgrade: false

timezone: UTC
timezone: Europe/Berlin

nextcloud_postgresql_lc: de_DE.UTF-8

nextcloud_php_version: 7.3

+ 3
- 2
tasks/install.yml Просмотреть файл

@@ -24,8 +24,9 @@
php occ maintenance:install
--admin-user "{{ nextcloud_admin_user }}"
--admin-pass "{{ nextcloud_admin_pass }}"
--database "{{ nextcloud_database_type }}"
--database-host "{{ (nextcloud_database_host == inventory_hostname) | ternary('localhost',nextcloud_database_host) }}"
--database "{{ _nextcloud_database_type_cli[nextcloud_database_type] }}"
--database-host "{{ (nextcloud_database_host == inventory_hostname)
| ternary(_nextcloud_database_localhost_cli[nextcloud_database_type],nextcloud_database_host) }}"
--database-name "{{ nextcloud_database_name }}"
--database-user "{{ nextcloud_database_user }}"
--database-pass "{{ nextcloud_database_pass }}"


+ 3
- 0
tasks/main.yml Просмотреть файл

@@ -22,6 +22,9 @@
- import_tasks: mysql.yml
when: nextcloud_database_type == "mysql"

- import_tasks: postgresql.yaml
when: nextcloud_database_type == "postgresql"

- import_tasks: core.yml
when:
nextcloud_state == "reinstalled" or


+ 2
- 2
tasks/mysql.yml Просмотреть файл

@@ -6,7 +6,7 @@
host: "{{ (nextcloud_database_host == inventory_hostname) | ternary('localhost',nextcloud_database_host) }}"
password: "{{ nextcloud_database_pass }}"
priv: "{{nextcloud_database_name}}.*:ALL"
delegate_to: "{{ nextcloud_database_host }}"
delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}"

- name: mysql database
mysql_db:
@@ -14,4 +14,4 @@
encoding: utf8mb4
collation: utf8mb4_unicode_ci
state: present
delegate_to: "{{ nextcloud_database_host }}"
delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}"

+ 26
- 0
tasks/postgresql.yaml Просмотреть файл

@@ -0,0 +1,26 @@
---

- name: debian packages required for database management
apt:
pkg: python-psycopg2
delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}"

- name: postgresql database
postgresql_db:
name: "{{nextcloud_database_name}}"
encoding: UTF-8
lc_collate: "{{nextcloud_postgresql_lc}}"
lc_ctype: "{{nextcloud_postgresql_lc}}"
template: template0
delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}"
become: yes
become_user: postgres

- name: postgresql user
postgresql_user:
name: "{{ nextcloud_database_user }}"
password: "{{ nextcloud_database_pass }}"
db: "{{nextcloud_database_name}}"
delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}"
become: yes
become_user: postgres

+ 15
- 1
tasks/reset.yml Просмотреть файл

@@ -10,13 +10,27 @@
path: "{{nextcloud_directory}}"
state: absent

- name: delete nextcloud lib directory
file:
path: "{{nextcloud_lib_directory}}"
state: absent

- name: drop mysql database
mysql_db:
name: "{{nextcloud_database_name}}"
state: absent
delegate_to: "{{ nextcloud_database_host }}"
delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}"
when: nextcloud_database_type == "mysql"

- name: drop postgresql database
postgresql_db:
name: "{{nextcloud_database_name}}"
state: absent
delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}"
when: nextcloud_database_type == "postgresql"
become: yes
become_user: postgres

- name: delete nextcloud log
file:
path: /var/log/nextcloud/nextcloud.log


+ 2
- 0
tasks/setup_Debian.yml Просмотреть файл

@@ -19,6 +19,7 @@
- php{{nextcloud_php_version}}-mbstring
- php{{nextcloud_php_version}}-zip
- php{{nextcloud_php_version}}-mysql
- php{{nextcloud_php_version}}-pgsql
- php{{nextcloud_php_version}}-curl
- php{{nextcloud_php_version}}-intl
- php{{nextcloud_php_version}}-imagick
@@ -29,4 +30,5 @@
- php{{nextcloud_php_version}}-memcached
- libreoffice
- mariadb-client
- rsync
notify: restart apache2

+ 8
- 0
vars/main.yml Просмотреть файл

@@ -11,3 +11,11 @@ _nextcloud_valid_states:
- reinstalled
- installed
- updated

_nextcloud_database_type_cli:
mysql: mysql
postgresql: pgsql

_nextcloud_database_localhost_cli:
mysql: localhost
postgresql: /var/run/postgresql

Загрузка…
Отмена
Сохранить