implement non-interactive post-install
This commit is contained in:
parent
20ec60eba0
commit
55466b7efb
4 changed files with 47 additions and 18 deletions
|
@ -13,6 +13,9 @@ nextcloud_hostname: ''
|
||||||
|
|
||||||
nextcloud_path_prefix: /
|
nextcloud_path_prefix: /
|
||||||
|
|
||||||
|
nextcloud_initial_admin_username: admin
|
||||||
|
nextcloud_initial_admin_password: ''
|
||||||
|
|
||||||
nextcloud_version: 30.0.0
|
nextcloud_version: 30.0.0
|
||||||
|
|
||||||
nextcloud_uid: ''
|
nextcloud_uid: ''
|
||||||
|
@ -326,6 +329,11 @@ nextcloud_config_parameters: "{{ nextcloud_config_default_parameters + nextcloud
|
||||||
nextcloud_config_default_parameters: |
|
nextcloud_config_default_parameters: |
|
||||||
{{
|
{{
|
||||||
([
|
([
|
||||||
|
{
|
||||||
|
'key': 'trusted_domains 1',
|
||||||
|
'value': nextcloud_hostname,
|
||||||
|
'type': 'string',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'key': 'overwriteprotocol',
|
'key': 'overwriteprotocol',
|
||||||
'value': 'https',
|
'value': 'https',
|
||||||
|
|
|
@ -13,17 +13,15 @@
|
||||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/install.yml"
|
ansible.builtin.include_tasks: "{{ role_path }}/tasks/install.yml"
|
||||||
|
|
||||||
- tags:
|
- tags:
|
||||||
- adjust-nextcloud-config
|
- post-install-all
|
||||||
|
- post-install-nextcloud
|
||||||
block:
|
block:
|
||||||
|
- when: nextcloud_enabled | bool
|
||||||
|
ansible.builtin.include_tasks: "{{ role_path }}/tasks/post_install.yml"
|
||||||
|
|
||||||
- when: nextcloud_enabled | bool
|
- when: nextcloud_enabled | bool
|
||||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/adjust_config.yml"
|
ansible.builtin.include_tasks: "{{ role_path }}/tasks/adjust_config.yml"
|
||||||
|
|
||||||
- tags:
|
|
||||||
- print-nextcloud-db-credentials
|
|
||||||
block:
|
|
||||||
- when: nextcloud_enabled | bool
|
|
||||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/print_db_credentials.yml"
|
|
||||||
|
|
||||||
- tags:
|
- tags:
|
||||||
- install-nextcloud-app-collabora
|
- install-nextcloud-app-collabora
|
||||||
block:
|
block:
|
||||||
|
|
34
tasks/post_install.yml
Normal file
34
tasks/post_install.yml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- 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 != '')"
|
|
@ -1,11 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- name: Print Nextcloud DB credentials
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: >-
|
|
||||||
Your Nextcloud database information is:
|
|
||||||
Host (`{{ nextcloud_database_hostname }}`),
|
|
||||||
Port (`{{ nextcloud_database_port }}`),
|
|
||||||
Database Name (`{{ nextcloud_database_name }}`),
|
|
||||||
Database Username (`{{ nextcloud_database_username }}`),
|
|
||||||
Database Password (`{{ nextcloud_database_password }}`)
|
|
Loading…
Reference in a new issue