| 1 |
============= |
| 2 |
groups.conf |
| 3 |
============= |
| 4 |
|
| 5 |
----------------------------------------------- |
| 6 |
Configuration file for ClusterShell node groups |
| 7 |
----------------------------------------------- |
| 8 |
|
| 9 |
:Author: Stephane Thiell |
| 10 |
:Date: 2026-07-16 |
| 11 |
:Copyright: GNU Lesser General Public License version 2.1 or later (LGPLv2.1+) |
| 12 |
:Version: 1.10.1 |
| 13 |
:Manual section: 5 |
| 14 |
:Manual group: ClusterShell User Manual |
| 15 |
|
| 16 |
|
| 17 |
DESCRIPTION |
| 18 |
=========== |
| 19 |
|
| 20 |
The ClusterShell library obtains its node groups configuration from the |
| 21 |
following sources, in decreasing order of precedence: |
| 22 |
|
| 23 |
1. *$CLUSTERSHELL_CFGDIR/groups.conf* (only used when $CLUSTERSHELL_CFGDIR |
| 24 |
is defined) |
| 25 |
2. user configuration file (*$XDG_CONFIG_HOME/clustershell/groups.conf*, |
| 26 |
defaults to *$HOME/.config/clustershell/groups.conf*) |
| 27 |
3. Python virtual environment (*{sys.prefix}/etc/clustershell/groups.conf*) |
| 28 |
4. local pip user installation (*$HOME/.local/etc/clustershell/groups.conf*) |
| 29 |
5. system-wide configuration file (*/etc/clustershell/groups.conf*) |
| 30 |
|
| 31 |
For each parameter, the first obtained value will be used. If no *groups.conf* |
| 32 |
is found, group support will be disabled. |
| 33 |
|
| 34 |
Additional configuration files are also read from the directories set by the |
| 35 |
confdir option, if present. See the ``confdir`` option below for further |
| 36 |
details. |
| 37 |
|
| 38 |
Configuration files have a format in the style of RFC 822 potentially composed |
| 39 |
of several sections which may be present in any order. There are two types of |
| 40 |
sections: Main and *Group_source*: |
| 41 |
|
| 42 |
Main |
| 43 |
Global configuration options. There should be only one Main section. |
| 44 |
*Group_source* |
| 45 |
The *Group_source* section(s) define the configuration for each node group |
| 46 |
source (or namespace). This configuration consists of external command |
| 47 |
definitions (map, mapall, all, list and reverse). |
| 48 |
|
| 49 |
Only *Group_source* section(s) are allowed in additional configuration files. |
| 50 |
|
| 51 |
|
| 52 |
[Main] OPTIONS |
| 53 |
-------------- |
| 54 |
Configuration parameters of the ``Main`` section are described below. |
| 55 |
|
| 56 |
default |
| 57 |
Specify the default group source (group namespace) used by the NodeSet parser |
| 58 |
when the user does not explicitly specify the group source (e.g. "@io"). |
| 59 |
|
| 60 |
confdir |
| 61 |
Optional list of directories where the ClusterShell library should look for |
| 62 |
**.conf** files which define group sources to use. Each file in these |
| 63 |
directories with the .conf suffix should contain one or more *Group_source* |
| 64 |
sections as documented in [*Group_source*] options below. These will be merged |
| 65 |
with the group sources defined in */etc/clustershell/groups.conf* to form the |
| 66 |
complete set of group sources that ClusterShell will use. Duplicate |
| 67 |
*Group_source* sections are not allowed. Note: .conf files that are not |
| 68 |
readable by the current user are ignored (except the one that defines the |
| 69 |
default group source). The variable *$CFGDIR* is replaced by the path of the |
| 70 |
highest priority configuration directory found (where groups.conf resides). |
| 71 |
The default confdir value enables both system-wide and any installed user |
| 72 |
configuration (thanks to *$CFGDIR*). Duplicate directory paths are ignored. |
| 73 |
``groupsdir`` is accepted as an alias for ``confdir`` and takes precedence |
| 74 |
when both are defined. |
| 75 |
|
| 76 |
autodir |
| 77 |
Optional list of directories where the ClusterShell library should look for |
| 78 |
**.yaml** files that define in-file group dictionaries. No need to call |
| 79 |
external commands for these files, they are parsed by the ClusterShell library |
| 80 |
itself. Multiple group source definitions in the same file are supported. The |
| 81 |
variable *$CFGDIR* is replaced by the path of the highest priority |
| 82 |
configuration directory found (where groups.conf resides). The default |
| 83 |
autodir value enables both system-wide and any installed user configuration |
| 84 |
(thanks to *$CFGDIR*). Duplicate directory paths are ignored. |
| 85 |
|
| 86 |
|
| 87 |
[*Group_source*] OPTIONS |
| 88 |
------------------------ |
| 89 |
Configuration parameters of each group source section are described below. |
| 90 |
|
| 91 |
map |
| 92 |
Specify the external shell command used to resolve a group name into a |
| 93 |
nodeset, list of nodes or list of nodeset (separated by space characters or |
| 94 |
by carriage returns). The variable *$GROUP* is replaced before executing the |
| 95 |
command. Either ``map`` or ``mapall`` must be defined. |
| 96 |
mapall |
| 97 |
Optional external shell command that should return all group-to-nodes |
| 98 |
mappings for this group source in a single call, one *group: nodes* line |
| 99 |
per group. Useful when the source can dump all its groups at once (e.g. |
| 100 |
with *sinfo* or *ansible-inventory --list*), as a single call then serves |
| 101 |
both ``map`` and ``list`` queries from the cache. ``mapall`` output takes |
| 102 |
precedence over the ``list`` upcall. If ``map`` is also defined, it is |
| 103 |
used as a fallback for groups missing from the ``mapall`` output (or all |
| 104 |
groups if caching is disabled); otherwise, missing groups resolve to an |
| 105 |
empty nodeset. |
| 106 |
The first ``:`` on each line separates the group name from the nodes, so |
| 107 |
group names must be single words without ``:``. Duplicate group lines are |
| 108 |
merged. A malformed output line makes the whole ``mapall`` call fail |
| 109 |
(nothing is cached and the next query retries), and a failing ``mapall`` |
| 110 |
command does not fall back to ``map``. |
| 111 |
all |
| 112 |
Optional external shell command that should return a nodeset, list of |
| 113 |
nodes or list of nodeset of all nodes for this group source. If not |
| 114 |
specified, the library will try to resolve all nodes by using the ``list`` |
| 115 |
external command in the same group source followed by ``map`` for each group. |
| 116 |
list |
| 117 |
Optional external shell command that should return the list of all groups |
| 118 |
for this group source (separated by space characters or by carriage |
| 119 |
returns). Not used when ``mapall`` is defined, unless caching is disabled. |
| 120 |
reverse |
| 121 |
Optional external shell command used to find the group(s) of a single |
| 122 |
node. The variable $NODE is replaced beforehand. If this upcall is not |
| 123 |
specified, the reverse operation is computed in memory by the library from |
| 124 |
the *list* and *map* external calls. Also, if the number of nodes to |
| 125 |
reverse is greater than the number of available groups, the *reverse* |
| 126 |
external command is avoided automatically. |
| 127 |
cache_time |
| 128 |
Number of seconds each upcall result is kept in cache, in memory only. |
| 129 |
Default is 3600 seconds. This is useful only for daemons using nodegroups. |
| 130 |
|
| 131 |
When the library executes a group source external shell command, the current |
| 132 |
working directory is set beforehand to the corresponding confdir. This |
| 133 |
allows the use of relative paths for third party files in the command. The |
| 134 |
command's standard input is connected to */dev/null*. |
| 135 |
|
| 136 |
In addition to context-dependent $GROUP and $NODE variables described above, the |
| 137 |
two following variables are always available and also replaced before executing |
| 138 |
shell commands: |
| 139 |
|
| 140 |
* *$CFGDIR* is replaced by groups.conf highest priority base directory path |
| 141 |
* *$SOURCE* is replaced by current source name |
| 142 |
|
| 143 |
Each external command might return a non-zero return code when the operation |
| 144 |
is not doable. But if the call returns zero, for instance, for a non-existing |
| 145 |
group, the user will not receive any error when trying to resolve such an |
| 146 |
unknown group. The desired behavior is up to the system administrator. |
| 147 |
|
| 148 |
|
| 149 |
RESOURCE USAGE |
| 150 |
============== |
| 151 |
|
| 152 |
All external command results are cached in memory to avoid multiple calls. Each |
| 153 |
result is kept for a limited amount of time. See cache_time option to tune |
| 154 |
this behavior. |
| 155 |
|
| 156 |
|
| 157 |
EXAMPLES |
| 158 |
======== |
| 159 |
|
| 160 |
Simple configuration file for local groups and Slurm partitions binding. |
| 161 |
|
| 162 |
*groups.conf* |
| 163 |
------------- |
| 164 |
|
| 165 |
| [Main] |
| 166 |
| default: local |
| 167 |
| confdir: /etc/clustershell/groups.conf.d $CFGDIR/groups.conf.d |
| 168 |
| autodir: /etc/clustershell/groups.d $CFGDIR/groups.d |
| 169 |
| |
| 170 |
| [local] |
| 171 |
| map: sed -n 's/^$GROUP:\\(.*\\)/\\1/p' /etc/clustershell/groups |
| 172 |
| list: sed -n 's/^\\([0-9A-Za-z\_-]\*\\):.*/\\1/p' /etc/clustershell/groups |
| 173 |
| |
| 174 |
| [slurm] |
| 175 |
| map: sinfo -h -o "%N" -p $GROUP |
| 176 |
| all: sinfo -h -o "%N" |
| 177 |
| list: sinfo -h -o "%P" |
| 178 |
| reverse: sinfo -h -N -o "%P" -n $NODE |
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
FILES |
| 183 |
===== |
| 184 |
|
| 185 |
*$CLUSTERSHELL_CFGDIR/groups.conf* (defaults to */etc/clustershell/groups.conf*) |
| 186 |
Global node groups configuration file. |
| 187 |
|
| 188 |
*$CLUSTERSHELL_CFGDIR/groups.conf.d/* (defaults to */etc/clustershell/groups.conf.d/*) |
| 189 |
Recommended directory for additional configuration files. |
| 190 |
|
| 191 |
*$CLUSTERSHELL_CFGDIR/groups.d/* (defaults to */etc/clustershell/groups.d/*) |
| 192 |
Recommended directory for *autodir*, where native group definition files |
| 193 |
(.yaml files) are found. |
| 194 |
|
| 195 |
*$XDG_CONFIG_HOME/clustershell/groups.conf* |
| 196 |
Main user groups.conf configuration file. If $XDG_CONFIG_HOME is not defined, |
| 197 |
*$HOME/.config/clustershell/groups.conf* is used instead. |
| 198 |
|
| 199 |
*{sys.prefix}/etc/clustershell/groups.conf* |
| 200 |
Configuration file when ClusterShell is installed in a Python virtual |
| 201 |
environment. |
| 202 |
|
| 203 |
*$HOME/.local/etc/clustershell/groups.conf* |
| 204 |
Local groups.conf user configuration file (default installation for pip --user) |
| 205 |
|
| 206 |
|
| 207 |
SEE ALSO |
| 208 |
======== |
| 209 |
|
| 210 |
``clubak``\(1), ``cluset``\(1), ``clush``\(1), ``nodeset``\(1) |
| 211 |
|
| 212 |
https://clustershell.readthedocs.io/ |