Use occ to modify configuration.

This commit is contained in:
Andreas B. Mundt 2020-01-14 14:51:52 +01:00
parent 2a161df7bb
commit 23605d6962

View file

@ -100,6 +100,10 @@
priv: 'nextcloud.*:ALL' priv: 'nextcloud.*:ALL'
state: present state: present
- name: check if we are installing
stat: path="{{ nc_dir }}"
register: nextcloud
- name: unpack nextcloud archive - name: unpack nextcloud archive
unarchive: unarchive:
src: nextcloud.tar.bz2 src: nextcloud.tar.bz2
@ -114,12 +118,12 @@
state: directory state: directory
owner: www-data owner: www-data
group: www-data group: www-data
recurse: yes recurse: Yes
- name: initialize nextcloud - name: initialize nextcloud
command: command:
cmd: > cmd: >
sudo -u www-data php occ maintenance:install sudo -u www-data php ./occ maintenance:install
--database "mysql" --database "mysql"
--database-name "nextcloud" --database-name "nextcloud"
--database-user "nextcloud" --database-user "nextcloud"
@ -130,22 +134,26 @@
args: args:
chdir: "{{ nc_dir }}" chdir: "{{ nc_dir }}"
creates: "{{ nc_dir }}/config/config.php" creates: "{{ nc_dir }}/config/config.php"
no_log: true no_log: True
- name: dump nc-admin password - name: dump nc-admin password
shell: echo -n "{{ nc_admin_pwd }}" > "{{ nc_admin_pwd_file }}" ; chmod 0600 "{{ nc_admin_pwd_file }}" shell: echo -n "{{ nc_admin_pwd }}" > "{{ nc_admin_pwd_file }}" ; chmod 0600 "{{ nc_admin_pwd_file }}"
no_log: true no_log: True
args: args:
creates: "{{ nc_admin_pwd_file }}" creates: "{{ nc_admin_pwd_file }}"
- name: enable APCu memcache - name: enable APCu memcache
lineinfile: command: sudo -u www-data php ./occ config:system:set memcache.local --value='\OC\Memcache\APCu'
dest: "{{ nc_dir }}/config/config.php" args:
line: " 'memcache.local' => '\\OC\\Memcache\\APCu'," chdir: "{{ nc_dir }}"
insertbefore: "'installed' => true," warn: False
when: not nextcloud.stat.exists
- name: allow access from LAN - name: allow access from LAN
lineinfile: command: sudo -u www-data php ./occ config:system:set trusted_domains 1 --value='192.168.*.*'
dest: "{{ nc_dir }}/config/config.php" args:
line: " 1 => '192.168.*.*'," chdir: "{{ nc_dir }}"
insertafter: "0 => 'localhost'," warn: False
when: not nextcloud.stat.exists
## ToDo: enable apps etc., update