---
# Install-behaviour flags sit at the top level for plugins entries, but under `config:` for addons entries.
- name: "๐ฆ Normalise install flags for {{ plugin_key }}"
ansible.builtin.set_fact:
plugin_incompatible: "{{ plugin_value.config.incompatible_plugins | default(plugin_value.incompatible_plugins | default([])) }}"
plugin_mandatory: "{{ plugin_value.config.mandatory | default(plugin_value.mandatory | default(false)) }}"
plugin_archive: "{{ plugin_value.config.archive | default(plugin_value.archive | default('')) }}"
changed_when: false
- name: "โฌ๏ธ Stage the pinned {{ plugin_key }} archive release"
when: plugin_archive | length > 0
block:
- name: "โฌ๏ธ Stage the pinned {{ plugin_key }} release on the node"
get_url_retry:
url: "{{ plugin_archive }}"
dest: "/tmp/nextcloud-plugin-{{ plugin_key }}.tar.gz"
mode: "0644"
- name: "๐ฆ Replace {{ plugin_key }} with the pinned release when any of its files differ"
ansible.builtin.shell: >-
cat /tmp/nextcloud-plugin-{{ plugin_key }}.tar.gz
| {{ NEXTCLOUD_DOCKER_EXEC_INTERACTIVE }}
sh -c {{ lookup('file', 'shell/utils/replace_pinned_app.sh') | quote }}
replace_pinned_app.sh {{ NEXTCLOUD_APPS_DIRECTORY | quote }} {{ plugin_key | quote }}
args:
executable: /bin/bash
register: nextcloud_plugin_archive_replace
changed_when: "'[CHANGED]' in nextcloud_plugin_archive_replace.stdout"
- name: "๐ด Disable incompatible plugins for {{ plugin_key }} (batched shell, no async)"
ansible.builtin.shell: |
{% for incompatible_plugin in (plugin_incompatible | default([])) %}
{{ NEXTCLOUD_DOCKER_EXEC_OCC }} app:disable {{ incompatible_plugin }} || true
{% endfor %}
args:
executable: /bin/bash
when:
- plugin_incompatible | length > 0
register: disable_incompat
changed_when: >
(((disable_incompat.stdout | default('')) ~ (disable_incompat.stderr | default('')))
is search('disabled'))
and (
(((disable_incompat.stdout | default('')) ~ (disable_incompat.stderr | default('')))
is not search('already disabled'))
)
failed_when: false
- name: ๐ฆ install {{ plugin_key }} nextcloud plugin
ansible.builtin.shell: |
{{ NEXTCLOUD_DOCKER_EXEC_OCC }} config:app:delete settings appstore-fetcher-lastFailure >/dev/null 2>&1 || true
{{ NEXTCLOUD_DOCKER_EXEC_OCC }} app:install {{ plugin_key }}
args:
executable: /bin/bash
register: install_result
retries: 6
delay: 30
until: (install_result | nextcloud_install_status).ok
failed_when: >
not (install_result | nextcloud_install_status).ok
and not (install_result | nextcloud_install_status).unavailable
changed_when: (install_result | nextcloud_install_status).changed
- name: "๐ Mandatory plugin {{ plugin_key }} not installable on this Nextcloud version"
ansible.builtin.fail:
msg: >-
Mandatory Nextcloud plugin '{{ plugin_key }}' is
{{ 'not compatible with' if (install_result | nextcloud_install_status).incompatible else 'not available on the appstore for' }}
the pinned Nextcloud server version. This plugin gates SSO login, so the
deployment is aborted instead of provisioning a login-broken instance.
when:
- plugin_mandatory | bool
- not (install_result | nextcloud_install_status).runnable
- name: "๐ด Skip {{ plugin_key }}: not installable on this Nextcloud version"
ansible.builtin.debug:
msg: >-
Plugin '{{ plugin_key }}' is {{ 'not compatible with' if (install_result | nextcloud_install_status).incompatible else 'not available on the appstore for' }}
the currently pinned Nextcloud server version. Skipping enable/configure for this run.
when: >
(install_result | nextcloud_install_status).incompatible
or (install_result | nextcloud_install_status).unavailable
- include_tasks: 03_enable.yml
when:
- (install_result | nextcloud_install_status).runnable
- not (install_result | nextcloud_install_status).enabled
- name: "๐งฎ Queue {{ plugin_key }} for the batched configuration"
ansible.builtin.set_fact:
nextcloud_plugin_configure_keys: "{{ nextcloud_plugin_configure_keys + [plugin_key] }}"
when: (install_result | nextcloud_install_status).enabled