linuxfabrik.lfops.nextcloud_occ_app¶
Install, enable, disable or remove a Nextcloud app via occ
Synopsis¶
- Drives the Nextcloud
occ app:install,app:enable,app:disableandapp:removecommands to bring a single app into the desired state. - The current state is determined from
occ app:list --output=json(or from a pre-fetched listing passed via installed_apps_json) and is one ofenabled,disabledorabsent. Subsequentocccommands are only run when the current state does not already match state. - Going from
absenttoenabledinstalls the app with--keep-disabledand then enables it as a separate step, so the install path is the same regardless of whether the app should end up enabled or just present.
Available since LFOps 6.0.0.
Requirements¶
- A working Nextcloud installation with the
occcommand available.
Mandatory Parameters¶
name
- Name of the Nextcloud app (the app ID, e.g.
notify_push,comments). - Type: String.
Optional Parameters¶
force
- Pass
--forcetoapp:installandapp:enableso that Nextcloud installs apps that are not officially compatible with the running version. - Type: Bool.
- Default:
false
installed_apps_json
- Pre-fetched output of
occ app:list --output=json, as either a JSON string or an already-parsed dict. When set, the module skips theapp:listcall and reads the current state from this value, which avoids runningocconce per app when looping over a list. - Type: Raw.
occ_path
- Absolute path to the Nextcloud
occcommand. - Type: String.
- Default:
/var/www/html/nextcloud/occ
php_path
- PHP binary to invoke
occwith. A barephprelies on$PATH; pass an absolute path to pin a specific PHP version. - Type: String.
- Default:
php
state
- Desired state of the app.
enabled- install the app if missing and enable it.disabled- disable the app if it is currently enabled. Does nothing if the app is already disabled or absent.present- install the app if missing but leave it disabled. Does nothing if the app already exists in any state.absent- remove the app entirely. - Type: String. One of
absent,disabled,enabled,present. - Default:
enabled
Examples¶
- name: 'Enable a Nextcloud app'
linuxfabrik.lfops.nextcloud_occ_app:
name: 'notify_push'
state: 'enabled'
- name: 'Disable a Nextcloud app'
linuxfabrik.lfops.nextcloud_occ_app:
name: 'comments'
state: 'disabled'
- name: 'Remove a Nextcloud app'
linuxfabrik.lfops.nextcloud_occ_app:
name: 'survey_client'
state: 'absent'
- name: 'Install a Nextcloud app without enabling it'
linuxfabrik.lfops.nextcloud_occ_app:
name: 'notify_push'
state: 'present'
force: true
Return Values¶
changed
- Whether the app state had to be changed.
- Type: Bool.
- Returned: always.
current_state
- State of the app before any changes were applied. One of
enabled,disabledorabsent. - Type: String.
- Returned: always.
rc
- Exit code of the last
occcommand that was executed. Only the last one is reported, since failure of any earlier one aborts the module. - Type: Number.
- Returned: when changed and not in check mode.
stderr
- Standard error of the last
occcommand that was executed. - Type: String.
- Returned: when changed and not in check mode.
stdout
- Standard output of the last
occcommand that was executed. - Type: String.
- Returned: when changed and not in check mode.
Authors¶
- Linuxfabrik GmbH, Zurich, Switzerland, https://www.linuxfabrik.ch