server/nextcloud: Changed approach for config to import prepared JSON

dehydrated
Felix Stupp 4 years ago
parent 10541b5ecc
commit 71bf56e60f
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -18,6 +18,7 @@ nextcloud_keyring: "{{ user_directory }}/nextcloud.gpg"
nextcloud_release_file: "{{ user_directory }}/nextcloud.tar.bz2"
nextcloud_release_signature: "{{ nextcloud_release_file }}.asc"
nextcloud_config: "{{ nextcloud_installation_directory }}/config/config.php"
import_config_file: "{{ nextcloud_installation_directory }}/config/config.json"
status_page_path: "{{ phpfpm_status_page_path }}"
status_page_acl: "{{ nginx_status_page_acl }}"
@ -31,6 +32,27 @@ database_user: "{{ system_user }}"
nextcloud_admin_user: "admin"
nextcloud_admin_pass: "{{ lookup('password', 'credentials/' + inventory_hostname + '/' + domain + '/' + nextcloud_admin_user + ' length=80') }}"
import_config:
system:
# domain
"overwrite.cli.url": "{{ domain }}"
trusted_domains:
- "{{ domain }}"
# database
dbtype: mysql
dbhost: localhost
dbport: ""
dbuser: "{{ database_user }}"
dbpass: "{{ database_pass }}"
dbname: "{{ database_name }}"
# memcache
memcache.local: '\OC\Memcache\APCu'
memcache.distributed: '\OC\Memcache\Redis'
memcache.locking: '\OC\Memcache\Redis'
redis:
host: "{{ redis_socket_path }}"
port: 0
enabled_apps_list:
- accessibility
- activity

@ -71,40 +71,29 @@
chdir: "{{ nextcloud_installation_directory }}"
creates: "{{ nextcloud_config }}"
- name: Configure Nextcloud default domain
become_user: "{{ system_user }}"
lineinfile:
path: "{{ nextcloud_config }}"
firstmatch: yes
insertafter: "array \\("
regexp: "^(\\s*)0 => '([^.]\\.)+[^.]*',$"
line: " 0 => '{{ domain }}',"
validate: /usr/bin/php %s
- name: Configure Nextcloud default domain for cli
become_user: "{{ system_user }}"
lineinfile:
path: "{{ nextcloud_config }}"
firstmatch: yes
insertafter: "'version'"
regexp: "^(\\s*)'overwrite.cli.url' => '.*',$"
line: " 'overwrite.cli.url' => 'https://{{ domain }}',"
validate: /usr/bin/php %s
- name: Store additional Nextcloud configuration
copy:
content: "{{ import_config | to_nice_json }}\n"
dest: "{{ import_config_file }}"
owner: "{{ system_user }}"
group: "{{ system_user }}"
mode: u=rw,g=r,o=
register: import_config_file_task
tags:
- nextcloud_config
- name: Add additional entries to Nextcloud config
- name: Import additional Nextcloud configuration
become_user: "{{ system_user }}"
blockinfile:
path: "{{ nextcloud_config }}"
insertbefore: "^\\);"
block: |
'memcache.local' => '\\OC\\Memcache\\APCu',
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' => [
'host' => '{{ redis_socket_path }}',
'port' => 0,
],
validate: /usr/bin/php %s
command: >-
/usr/bin/php occ
config:import
{{ import_config_file }}
args:
chdir: "{{ nextcloud_installation_directory }}"
creates: "{{ nextcloud_config }}"
when: import_config_file_task.changed
tags:
- nextcloud_config
- name: Install Nextcloud apps
become_user: "{{ system_user }}"

Loading…
Cancel
Save