Default variable details
Some of debops.sysfs default variables have more extensive configuration
than simple strings or lists, here you can find documentation and examples for
them.
sysfs__attributes
The sysfs__*_attributes default variables hold the configuration of the
sysfsutils service, stored in the /etc/sysfs.d/ directory.
The variables are lists, with each entry defined as a YAML dictionary.
Dictionaries can be specified as a simple attribute/value form where the
dictionary key is a path to a sysfs file, and the dictionary value is the
value to set, or can be defined as more complex YAML dictionaries with specific
parameters:
nameRequired. The name of the
sysfsattribute to configure, usually specified as a filesystem path without the/sys/prefix.This parameter is used as the key when entries from multiple attribute lists are merged together. It's also used as a filename in the
/etc/sysfs.d/directory, with/characters replaced by_, unless theitem.filenameparameter is used.If the
item.optionsparameter is used, thesysfsattribute specified as the name is ignored and can be an arbitrary filename.valueOptional. Define the value of a given attribute. If
item.optionsparameter is used, the mainvalueparameter is ignored.ownerOptional. Set the "owner" and "group" of a file in the
/sys/filesystem. Specify values supported by the chown command. If theitem.optionsparameter is used, the mainownerparameter is ignored.modeOptional. Set the file attributes of a file in the
/sys/filesystem. Specify values supported by the chmod command. Make sure to quote the numerical values like0660, otherwise they will be interpreted by Ansible as octal and may result in unexpected behaviour. If theitem.optionsparameter is used, the mainmodeparameter is ignored.filenameOptional. A custom filename of the configuration file in
/etc/sysfs.d/directory. The.confsuffix is automatically appended.commentOptional. A string or YAML text block with a comment included in the configuration file.
stateOptional. Control the state of the generated configuration file.
If not specified or
present, the configuration file will be generated.If
absent, an existing configuration file will be removed.If
ignore, a given entry is ignored by Ansible during configuration merge, this can be used to conditionally enable or disable configuration entries.If
defined, a given entry is defined during configuration merge, but it won't change the state of the configuration file on the managed hosts. This state is useful mostly in the role default variables to definesysfsattributes which can be conditionally enabled from inventory or by other Ansible roles.If
comment, the configuration file will be generated, but all attributes will be commented out. This can be used to create example configuration files.optionsOptional. YAML list of
sysfsattributes with the same format as the one defined above. This parameter can be used to define multiple attributes in the same file. Supported parameters:name,state,value,owner,mode,comment.
Examples
Define the example configuration from the /etc/sysfs.conf as the role
configuration:
sysfs__attributes:
- name: 'devices/system/cpu/cpu0/cpufreq/scaling_governor'
comment: 'Always use the powersave CPU frequency governor'
value: 'powersave'
# Multiple attributes in one file
- name: 'userspace_cpufreq_governor'
comment: |
Use userspace CPU frequency governor and set initial speed
options:
- name: 'devices/system/cpu/cpu0/cpufreq/scaling_governor'
value: 'userspace'
- name: 'devices/system/cpu/cpu0/cpufreq/scaling_setspeed'
value: 600000
- name: 'power/state'
comment: 'Set permissions of suspend control file'
mode: '0600'
owner: 'root:power'