--- ## TODO: this is idempotent but flagging change would be nice - name: enable files_external app command: docker exec -u www-data nextcloud.service /var/www/html/occ app:enable files_external changed_when: false - name: check if elevate group exists in nextcloud (1/2) command: docker exec -u www-data nextcloud.service /var/www/html/occ group:list -n --output=json register: nextcloud_group_list changed_when: false check_mode: false - name: check if elevate group exists in nextcloud (2/2) set_fact: nextcloud_group_list: "{{ nextcloud_group_list.stdout | from_json }}" - name: create group elevate group in nextcloud command: docker exec -u www-data nextcloud.service /var/www/html/occ group:add -n elevate when: '"elevate" not in nextcloud_group_list' - name: check if external storage is configured in nextcloud (1/2) command: docker exec -u www-data nextcloud.service /var/www/html/occ files_external:list -n --output=json register: nextcloud_files_external_list changed_when: false check_mode: false - name: check if external storage is configured in nextcloud (2/2) set_fact: nextcloud_files_external_list: "{{ nextcloud_files_external_list.stdout | from_json }}" - name: configure external storage in nextcloud command: docker exec -u www-data nextcloud.service /var/www/html/occ files_external:create -n --output=json --config="datadir=/srv/external/share" Share local null::null when: not (nextcloud_files_external_list | nextcloud_mountpoint_exists('/Share')) ## TODO: this is idempotent but flagging change would be nice - name: set up permission for external storage command: docker exec -u www-data nextcloud.service /var/www/html/occ files_external:applicable -n --output=json 1 --add-group=elevate changed_when: false ## TODO: this is idempotent but flagging change would be nice - name: set up background tasks trigger to cron command: docker exec -u www-data nextcloud.service /var/www/html/occ background:cron changed_when: false ## TODO: this is idempotent but flagging change would be nice - name: set password for admin user command: 'docker exec -u www-data -e "OC_PASS={{ nextcloud_admin.password }}" nextcloud.service /var/www/html/occ user:resetpassword -n --password-from-env "{{ nextcloud_admin.username }}"' changed_when: false