--- - block: - name: nextcloud list config command: php occ config:list args: chdir: /var/www/nextcloud register: _nextcloud_config_cmd changed_when: false - name: nextcloud occ config:app:delete trusted_domains command: php occ config:system:delete trusted_domains args: chdir: /var/www/nextcloud when: _nextcloud_config.system.trusted_domains != nextcloud_server_names - name: nextcloud occ config:system:set trusted_domains command: php occ config:system:set trusted_domains {{ item.0 }} --value={{ item.1 }} args: chdir: /var/www/nextcloud with_indexed_items: "{{ nextcloud_server_names }}" when: _nextcloud_config.system.trusted_domains != nextcloud_server_names - name: nextcloud occ maintenance:update:htaccess command: php occ maintenance:update:htaccess args: chdir: /var/www/nextcloud - name: nextcloud occ background:cron command: php occ background:cron args: chdir: /var/www/nextcloud become: true become_user: www-data become_method: sudo