From 23605d69627bf0d0d1604872e45cb4606f595408 Mon Sep 17 00:00:00 2001 From: "Andreas B. Mundt" Date: Tue, 14 Jan 2020 14:51:52 +0100 Subject: [PATCH] Use occ to modify configuration. --- roles/nextcloud/tasks/main.yml | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml index d88f095..31a71fb 100644 --- a/roles/nextcloud/tasks/main.yml +++ b/roles/nextcloud/tasks/main.yml @@ -100,6 +100,10 @@ priv: 'nextcloud.*:ALL' state: present +- name: check if we are installing + stat: path="{{ nc_dir }}" + register: nextcloud + - name: unpack nextcloud archive unarchive: src: nextcloud.tar.bz2 @@ -114,12 +118,12 @@ state: directory owner: www-data group: www-data - recurse: yes + recurse: Yes - name: initialize nextcloud command: cmd: > - sudo -u www-data php occ maintenance:install + sudo -u www-data php ./occ maintenance:install --database "mysql" --database-name "nextcloud" --database-user "nextcloud" @@ -130,22 +134,26 @@ args: chdir: "{{ nc_dir }}" creates: "{{ nc_dir }}/config/config.php" - no_log: true + no_log: True - name: dump nc-admin password shell: echo -n "{{ nc_admin_pwd }}" > "{{ nc_admin_pwd_file }}" ; chmod 0600 "{{ nc_admin_pwd_file }}" - no_log: true + no_log: True args: creates: "{{ nc_admin_pwd_file }}" - name: enable APCu memcache - lineinfile: - dest: "{{ nc_dir }}/config/config.php" - line: " 'memcache.local' => '\\OC\\Memcache\\APCu'," - insertbefore: "'installed' => true," + command: sudo -u www-data php ./occ config:system:set memcache.local --value='\OC\Memcache\APCu' + args: + chdir: "{{ nc_dir }}" + warn: False + when: not nextcloud.stat.exists - name: allow access from LAN - lineinfile: - dest: "{{ nc_dir }}/config/config.php" - line: " 1 => '192.168.*.*'," - insertafter: "0 => 'localhost'," + command: sudo -u www-data php ./occ config:system:set trusted_domains 1 --value='192.168.*.*' + args: + chdir: "{{ nc_dir }}" + warn: False + when: not nextcloud.stat.exists + +## ToDo: enable apps etc., update