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_file: "{{ user_directory }}/nextcloud.tar.bz2"
nextcloud_release_signature: "{{ nextcloud_release_file }}.asc" nextcloud_release_signature: "{{ nextcloud_release_file }}.asc"
nextcloud_config: "{{ nextcloud_installation_directory }}/config/config.php" 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_path: "{{ phpfpm_status_page_path }}"
status_page_acl: "{{ nginx_status_page_acl }}" status_page_acl: "{{ nginx_status_page_acl }}"
@ -31,6 +32,27 @@ database_user: "{{ system_user }}"
nextcloud_admin_user: "admin" nextcloud_admin_user: "admin"
nextcloud_admin_pass: "{{ lookup('password', 'credentials/' + inventory_hostname + '/' + domain + '/' + nextcloud_admin_user + ' length=80') }}" 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: enabled_apps_list:
- accessibility - accessibility
- activity - activity

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

Loading…
Cancel
Save