Files
computer-playbook/roles/web-app-nextcloud/tasks/plugin/02_enable.yml
T
kevinveenbirkenbach eab16c0568 refactor(web-app-nextcloud): reshape plugin pipeline into install/enable/configure stages
Split the previous two-file plugin pipeline into three single-responsibility
stages and group them under tasks/plugin/, with per-plugin hooks now sitting
under tasks/plugin/hooks/. Each stage owns exactly one OCC call (app:install,
app:enable, config:app:set) and one continuation decision driven by the
nextcloud_install_status filter.

Layout:

  tasks/
  ├── 06_plugin.yml                 (entry; includes plugin/01_install.yml)
  └── plugin/
      ├── 01_install.yml            (occ app:install + classify)
      ├── 02_enable.yml             (occ app:enable + classify)
      ├── 03_configure.yml          (occ config:app:set + run hook)
      ├── hooks/                    (per-plugin extension tasks)
      │   └── user_ldap.yml
      └── README.md                 (pipeline contract + extension guide)

The new 02_enable.yml mirrors the version-compatibility tolerance that
01_install.yml already had: when occ rejects the enable with the
"is not compatible with this version of the server" marker, the
failed_when clause downgrades the task to a non-fatal classification,
emits a debug warning, and skips the entire 03_configure.yml include via
a single set_fact-driven flag instead of repeating the filter call on
every downstream task. This unblocks deploys against a Nextcloud release
whose appstore lags briefly while the plugin's compatibility metadata
catches up (e.g. metadata, drawio, files_bpm in the NC 33 window).

NEXTCLOUD_CNODE_PLUGIN_TASKS_PATH in vars/main.yml is rebased to the new
tasks/plugin/hooks/ directory so plugin hooks resolve at the new location
without touching call sites.

README.md follows the role + docs README contracts: one sentence per line,
no em dashes, RFC 2119 keywords, no historical narrative, cross-links to
the filter plugin and the role vars file.
2026-05-19 23:01:18 +02:00

26 lines
1.0 KiB
YAML

---
- name: enable {{ plugin_key }} nextcloud plugin
command: "{{ NEXTCLOUD_DOCKER_EXEC_OCC }} app:enable {{ plugin_key }}"
register: enable_result
failed_when: >
enable_result.rc != 0
and not (enable_result | nextcloud_install_status).incompatible
changed_when: >
enable_result.rc == 0
and ("already enabled" not in enable_result.stdout)
- name: "Classify {{ plugin_key }} enable result"
ansible.builtin.set_fact:
plugin_enable_incompatible: "{{ (enable_result | nextcloud_install_status).incompatible }}"
- name: "warn: {{ plugin_key }} is incompatible with current Nextcloud version — skipping enable+configure"
ansible.builtin.debug:
msg: >-
Plugin '{{ plugin_key }}' enable refused by occ: not compatible with the
currently pinned Nextcloud server version. Skipping configure for this run.
when: plugin_enable_incompatible
- name: "Configure {{ plugin_key }} (skipped when incompatible)"
ansible.builtin.include_tasks: 03_configure.yml
when: not plugin_enable_incompatible