1CDIST-TYPE__KEY_VALUE(7)             cdist            CDIST-TYPE__KEY_VALUE(7)
2
3
4

NAME

6       cdist-type__key_value - Change property values in files
7

DESCRIPTION

9       This cdist type allows you to change values in a key value based config
10       file.
11

REQUIRED PARAMETERS

13       file   The file to operate on.
14
15       delimiter
16              The delimiter which separates the key from the value.
17

OPTIONAL PARAMETERS

19       state  present or absent, defaults to present. If present, sets the key
20              to value, if absent, removes the key from the file.
21
22       key    The key to change. Defaults to object_id.
23
24       value  The value for the key. Optional if state=absent, required other‐
25              wise.
26
27       comment
28              If supplied, the value will be inserted before the line with the
29              key,  but only if the key or value must be changed.  You need to
30              ensure yourself that the line is prefixed with the correct  com‐
31              ment sign. (for example # or ; or wathever ..)
32
33       onchange
34              The  code  to run if the key or value changes (i.e. is inserted,
35              removed or replaced).
36

BOOLEAN PARAMETERS

38       exact_delimiter
39              If supplied, treat additional whitespaces between key, delimiter
40              and value as wrong value.
41

MESSAGES

43       remove Removed existing key and value
44
45       insert Added key and value
46
47       change Changed value of existing key
48
49       create A new line was inserted in a new file
50

EXAMPLES

52          # Set the maximum system user id
53          __key_value SYS_UID_MAX --file /etc/login.defs --value 666 --delimiter ' '
54
55          # Same with fancy id
56          __key_value my-fancy-id --file /etc/login.defs --key SYS_UID_MAX --value 666 \
57             --delimiter ' '
58
59          # Enable packet forwarding
60          __key_value net.ipv4.ip_forward --file /etc/sysctl.conf --value 1 \
61             --delimiter ' = ' --comment '# my linux kernel should act as a router'
62
63          # Remove existing key/value
64          __key_value LEGACY_KEY --file /etc/somefile --state absent --delimiter '='
65

MORE INFORMATION

67       This  type  try to handle as many values as possible, so it doesn't use
68       regexes.  So you need to exactly specify the key and delimiter.  Delim‐
69       iter can be of any length.
70

AUTHORS

72       Steven Armstrong <steven-cdist--@--armstrong.cc>
73

COPYING

75       Copyright  (C)  2011  Steven  Armstrong. You can redistribute it and/or
76       modify it under the terms of the GNU General  Public  License  as  pub‐
77       lished  by  the  Free  Software  Foundation,  either  version  3 of the
78       License, or (at your option) any later version.
79
81       ungleich GmbH 2019
82
83
84
85
866.3.0                            Dec 12, 2019         CDIST-TYPE__KEY_VALUE(7)
Impressum