1
0
Fork 0
mash-ansible-role-nextcloud/tasks/post_install.yml

34 lines
1.6 KiB
YAML

---
- name: Run occ maintenance:install
ansible.builtin.command:
cmd: >-
{{ devture_systemd_docker_base_host_command_docker }}
run
--rm
--name={{ nextcloud_identifier }}-post-install
--network={{ nextcloud_container_network }}
{% if postgres_enabled and nextcloud_database_hostname == postgres_identifier and nextcloud_container_network != postgres_container_network %}
--network={{ postgres_container_network }}
{% endif %}
--user={{ nextcloud_uid }}:{{ nextcloud_gid }}
--cap-drop=ALL
--read-only
--mount=type=bind,src={{ nextcloud_data_path }},dst=/var/www/html
--env-file={{ nextcloud_config_path }}/env
{{ nextcloud_container_image_final }}
php
/var/www/html/occ
maintenance:install
--database=pgsql
--database-host={{ nextcloud_database_hostname }}:{{ nextcloud_database_port }}
--database-name={{ nextcloud_database_name }}
--database-user={{ nextcloud_database_username }}
--database-pass={{ nextcloud_database_password }}
--admin-user={{ nextcloud_initial_admin_username }}
--admin-pass={{ nextcloud_initial_admin_password }}
register: result
# On successful change: 'Nextcloud was successfully installed' in result.stdout
# To be conservative, report 'changed' for any result other than the known 'already done' error message.
changed_when: "'Command \"maintenance:install\" is not defined.' not in result.stderr"
failed_when: "'Command \"maintenance:install\" is not defined.' not in result.stderr and (result.rc != 0 or result.stderr != '')"