linuxfabrik.lfops.nextcloud_occ_app_config¶
Manage a Nextcloud app configuration value via occ
Synopsis¶
- Drives
occ config:app:setandconfig:app:deleteto bring a single app config key into the desired state. - The current value and type are read from
occ config:app:get --details --output=json(or from a pre-fetchedocc config:list --output=json --privatelisting passed via installed_config_json).occ config:app:setis only called when the stored value or type does not already match. - When name contains spaces, each whitespace-separated token is passed as a separate argument to
occ, matching how Nextcloud addresses nested keys (e.g.name="endpoint enabled"). - Booleans are normalized for Nextcloud's storage. value values
true/1/on/yes(case-insensitive) become1in the database; everything else becomes0. When reading via installed_config_json, the type is inferred from the JSON value type (Pythonbool/int/float/list/str), sinceocc config:listreturns values already cast byconvertTypedValue().
Available since LFOps 6.0.0.
Requirements¶
- A working Nextcloud installation with the
occcommand available.
Mandatory Parameters¶
app
- App ID whose configuration is being managed (e.g.
core,files_sharing,notify_push). - Type: String.
name
- Configuration key. Multiple whitespace-separated tokens are forwarded as separate arguments to
occ, which is how Nextcloud addresses nested keys. - Type: String.
Optional Parameters¶
installed_config_json
- Pre-fetched output of
occ config:list --output=json --private, as either a JSON string or an already-parsed dict. When set, the module skips theconfig:app:getcall and reads the current value from this value, which avoids runningocconce per key when looping over many keys. - 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
presentcreates or updates the key,absentdeletes it.- Type: String. One of
absent,present. - Default:
present
type
- Data type
occ config:app:setrecords for the value. - Type: String. One of
string,integer,float,boolean,array. - Default:
string
value
- Target value for the configuration key. Required when state=C(present). When type=C(array), pass a valid JSON array literal; this module forwards the string verbatim and lets
occparse it. - Type: String.
Examples¶
- name: 'Set an app configuration value'
linuxfabrik.lfops.nextcloud_occ_app_config:
app: 'core'
name: 'shareapi_expire_after_n_days'
value: 90
type: 'integer'
occ_path: '/data/nextcloud/occ'
php_path: '/usr/bin/php'
Return Values¶
changed
- Whether the value or type had to be changed.
- Type: Bool.
- Returned: always.
current_type
- Stored type before any changes were applied. Empty string when the key did not exist.
- Type: String.
- Returned: always.
current_value
- Stored value (as a string) before any changes were applied. Empty string when the key did not exist. Booleans are normalized to
1/0to match how Nextcloud stores them. - Type: String.
- Returned: always.
rc
- Exit code of the
occ config:app:setorconfig:app:deletecommand. - Type: Number.
- Returned: when changed and not in check mode.
stderr
- Standard error of the
occ config:app:setorconfig:app:deletecommand. - Type: String.
- Returned: when changed and not in check mode.
stdout
- Standard output of the
occ config:app:setorconfig:app:deletecommand. - Type: String.
- Returned: when changed and not in check mode.
Authors¶
- Linuxfabrik GmbH, Zurich, Switzerland, https://www.linuxfabrik.ch