linuxfabrik.lfops.nextcloud_occ_system_config¶
Manage a Nextcloud system configuration value via occ
Synopsis¶
- Drives
occ config:system:setandconfig:system:deleteto bring a single system config key into the desired state. - The current value is read from
occ config:system:get(or from a pre-fetchedocc config:list --output=json --privatelisting passed via installed_config_json).occ config:system:setis only called when the stored value does not already match value. - 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="trusted_domains 0",name="forbidden_filename_characters 0"). - Booleans are normalized for
occ. value valuestrue/1/on/yes(case-insensitive) become the literal stringtrue; everything else becomesfalse. This matches what Nextcloud's CastHelper accepts onconfig:system:set. Note that this differs fromnextcloud_occ_app_config, which stores booleans as1/0.
Available since LFOps 6.0.0.
Requirements¶
- A working Nextcloud installation with the
occcommand available.
Mandatory Parameters¶
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:system:getcall and walks name through the dict tree (descending into both dicts and lists by index), 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:system:setrecords for the value. Note thatoccnames the floating point typedouble, notfloat. - Type: String. One of
string,integer,double,boolean. - Default:
string
value
- Target value for the configuration key. Required when state=C(present).
- Type: String.
Examples¶
- name: 'Set a system configuration value'
linuxfabrik.lfops.nextcloud_occ_system_config:
name: 'check_for_working_wellknown_setup'
value: true
type: 'boolean'
- name: 'Set an array subkey'
linuxfabrik.lfops.nextcloud_occ_system_config:
name: 'forbidden_filename_characters 0'
value: '*'
Return Values¶
changed
- Whether the value had to be changed.
- Type: Bool.
- Returned: always.
current_value
- Stored value (as a string) before any changes were applied. Empty string when the key did not exist. Booleans are returned lowercase (
true/false) to match whatocc config:system:setaccepts. - Type: String.
- Returned: always.
rc
- Exit code of the
occ config:system:setorconfig:system:deletecommand. - Type: Number.
- Returned: when changed and not in check mode.
stderr
- Standard error of the
occ config:system:setorconfig:system:deletecommand. - Type: String.
- Returned: when changed and not in check mode.
stdout
- Standard output of the
occ config:system:setorconfig:system:deletecommand. - Type: String.
- Returned: when changed and not in check mode.
Authors¶
- Linuxfabrik GmbH, Zurich, Switzerland, https://www.linuxfabrik.ch