@@ -28,6 +28,8 @@ nextcloud_server_names: | |||||
nextcloud_force_downgrade: false | nextcloud_force_downgrade: false | ||||
timezone: UTC | |||||
timezone: Europe/Berlin | |||||
nextcloud_postgresql_lc: de_DE.UTF-8 | |||||
nextcloud_php_version: 7.3 | nextcloud_php_version: 7.3 |
@@ -24,8 +24,9 @@ | |||||
php occ maintenance:install | php occ maintenance:install | ||||
--admin-user "{{ nextcloud_admin_user }}" | --admin-user "{{ nextcloud_admin_user }}" | ||||
--admin-pass "{{ nextcloud_admin_pass }}" | --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-name "{{ nextcloud_database_name }}" | ||||
--database-user "{{ nextcloud_database_user }}" | --database-user "{{ nextcloud_database_user }}" | ||||
--database-pass "{{ nextcloud_database_pass }}" | --database-pass "{{ nextcloud_database_pass }}" | ||||
@@ -22,6 +22,9 @@ | |||||
- import_tasks: mysql.yml | - import_tasks: mysql.yml | ||||
when: nextcloud_database_type == "mysql" | when: nextcloud_database_type == "mysql" | ||||
- import_tasks: postgresql.yaml | |||||
when: nextcloud_database_type == "postgresql" | |||||
- import_tasks: core.yml | - import_tasks: core.yml | ||||
when: | when: | ||||
nextcloud_state == "reinstalled" or | nextcloud_state == "reinstalled" or | ||||
@@ -6,7 +6,7 @@ | |||||
host: "{{ (nextcloud_database_host == inventory_hostname) | ternary('localhost',nextcloud_database_host) }}" | host: "{{ (nextcloud_database_host == inventory_hostname) | ternary('localhost',nextcloud_database_host) }}" | ||||
password: "{{ nextcloud_database_pass }}" | password: "{{ nextcloud_database_pass }}" | ||||
priv: "{{nextcloud_database_name}}.*:ALL" | 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 | - name: mysql database | ||||
mysql_db: | mysql_db: | ||||
@@ -14,4 +14,4 @@ | |||||
encoding: utf8mb4 | encoding: utf8mb4 | ||||
collation: utf8mb4_unicode_ci | collation: utf8mb4_unicode_ci | ||||
state: present | state: present | ||||
delegate_to: "{{ nextcloud_database_host }}" | |||||
delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}" |
@@ -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 |
@@ -10,13 +10,27 @@ | |||||
path: "{{nextcloud_directory}}" | path: "{{nextcloud_directory}}" | ||||
state: absent | state: absent | ||||
- name: delete nextcloud lib directory | |||||
file: | |||||
path: "{{nextcloud_lib_directory}}" | |||||
state: absent | |||||
- name: drop mysql database | - name: drop mysql database | ||||
mysql_db: | mysql_db: | ||||
name: "{{nextcloud_database_name}}" | name: "{{nextcloud_database_name}}" | ||||
state: absent | state: absent | ||||
delegate_to: "{{ nextcloud_database_host }}" | |||||
delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}" | |||||
when: nextcloud_database_type == "mysql" | 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 | - name: delete nextcloud log | ||||
file: | file: | ||||
path: /var/log/nextcloud/nextcloud.log | path: /var/log/nextcloud/nextcloud.log | ||||
@@ -19,6 +19,7 @@ | |||||
- php{{nextcloud_php_version}}-mbstring | - php{{nextcloud_php_version}}-mbstring | ||||
- php{{nextcloud_php_version}}-zip | - php{{nextcloud_php_version}}-zip | ||||
- php{{nextcloud_php_version}}-mysql | - php{{nextcloud_php_version}}-mysql | ||||
- php{{nextcloud_php_version}}-pgsql | |||||
- php{{nextcloud_php_version}}-curl | - php{{nextcloud_php_version}}-curl | ||||
- php{{nextcloud_php_version}}-intl | - php{{nextcloud_php_version}}-intl | ||||
- php{{nextcloud_php_version}}-imagick | - php{{nextcloud_php_version}}-imagick | ||||
@@ -29,4 +30,5 @@ | |||||
- php{{nextcloud_php_version}}-memcached | - php{{nextcloud_php_version}}-memcached | ||||
- libreoffice | - libreoffice | ||||
- mariadb-client | - mariadb-client | ||||
- rsync | |||||
notify: restart apache2 | notify: restart apache2 |
@@ -11,3 +11,11 @@ _nextcloud_valid_states: | |||||
- reinstalled | - reinstalled | ||||
- installed | - installed | ||||
- updated | - updated | ||||
_nextcloud_database_type_cli: | |||||
mysql: mysql | |||||
postgresql: pgsql | |||||
_nextcloud_database_localhost_cli: | |||||
mysql: localhost | |||||
postgresql: /var/run/postgresql |