2011-03-24 22:16:25 +00:00
|
|
|
cdist-type__key_value(7)
|
2011-03-24 22:22:08 +00:00
|
|
|
========================
|
2016-06-23 14:08:59 +00:00
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
|
|
|
cdist-type__key_value - Change property values in files
|
2011-03-24 22:16:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
|
|
|
This cdist type allows you to change values in a key value based config
|
|
|
|
file.
|
|
|
|
|
|
|
|
|
|
|
|
REQUIRED PARAMETERS
|
|
|
|
-------------------
|
2016-05-20 06:50:56 +00:00
|
|
|
file
|
2011-03-24 22:16:25 +00:00
|
|
|
The file to operate on.
|
2016-05-20 06:50:56 +00:00
|
|
|
delimiter
|
2016-05-05 07:58:35 +00:00
|
|
|
The delimiter which separates the key from the value.
|
2011-03-24 22:16:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
OPTIONAL PARAMETERS
|
|
|
|
-------------------
|
2016-05-20 06:50:56 +00:00
|
|
|
state
|
2014-02-25 10:35:14 +00:00
|
|
|
present or absent, defaults to present. If present, sets the key to value,
|
|
|
|
if absent, removes the key from the file.
|
2016-05-20 06:50:56 +00:00
|
|
|
key
|
2014-02-25 10:35:14 +00:00
|
|
|
The key to change. Defaults to object_id.
|
2016-05-20 06:50:56 +00:00
|
|
|
value
|
2014-02-25 10:35:14 +00:00
|
|
|
The value for the key. Optional if state=absent, required otherwise.
|
2016-05-20 06:50:56 +00:00
|
|
|
comment
|
2014-02-27 13:45:19 +00:00
|
|
|
If supplied, the value will be inserted before the line with the key,
|
|
|
|
but only if the key or value must be changed.
|
|
|
|
You need to ensure yourself that the line is prefixed with the correct
|
|
|
|
comment sign. (for example # or ; or wathever ..)
|
|
|
|
|
|
|
|
|
|
|
|
BOOLEAN PARAMETERS
|
|
|
|
------------------
|
2016-05-20 06:50:56 +00:00
|
|
|
exact_delimiter
|
2014-02-27 20:08:45 +00:00
|
|
|
If supplied, treat additional whitespaces between key, delimiter and value
|
2014-02-27 13:45:19 +00:00
|
|
|
as wrong value.
|
|
|
|
|
|
|
|
|
|
|
|
MESSAGES
|
|
|
|
--------
|
2016-05-20 06:50:56 +00:00
|
|
|
remove
|
2014-03-12 19:07:27 +00:00
|
|
|
Removed existing key and value
|
2016-05-20 06:50:56 +00:00
|
|
|
insert
|
2014-03-11 14:39:08 +00:00
|
|
|
Added key and value
|
2016-05-20 06:50:56 +00:00
|
|
|
change
|
2014-03-11 14:39:08 +00:00
|
|
|
Changed value of existing key
|
2016-05-20 06:50:56 +00:00
|
|
|
create
|
2014-03-11 20:05:31 +00:00
|
|
|
A new line was inserted in a new file
|
2011-03-24 22:16:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES
|
|
|
|
--------
|
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
.. code-block:: sh
|
|
|
|
|
|
|
|
# Set the maximum system user id
|
|
|
|
__key_value SYS_UID_MAX --file /etc/login.defs --value 666 --delimiter ' '
|
2011-03-24 22:16:25 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
# Same with fancy id
|
|
|
|
__key_value my-fancy-id --file /etc/login.defs --key SYS_UID_MAX --value 666 \
|
|
|
|
--delimiter ' '
|
2011-03-24 22:16:25 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
# Enable packet forwarding
|
|
|
|
__key_value net.ipv4.ip_forward --file /etc/sysctl.conf --value 1 \
|
|
|
|
--delimiter ' = ' --comment '# my linux kernel should act as a router'
|
2012-02-03 21:43:34 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
# Remove existing key/value
|
2016-07-18 17:43:26 +00:00
|
|
|
__key_value LEGACY_KEY --file /etc/somefile --state absent --delimiter '='
|
2011-03-24 22:16:25 +00:00
|
|
|
|
|
|
|
|
2014-02-25 10:35:14 +00:00
|
|
|
MORE INFORMATION
|
|
|
|
----------------
|
2014-03-26 09:41:00 +00:00
|
|
|
This type try to handle as many values as possible, so it doesn't use regexes.
|
2016-07-18 17:43:26 +00:00
|
|
|
So you need to exactly specify the key and delimiter. Delimiter can be of any length.
|
2014-02-25 10:35:14 +00:00
|
|
|
|
|
|
|
|
2016-06-17 19:28:16 +00:00
|
|
|
AUTHORS
|
|
|
|
-------
|
|
|
|
Steven Armstrong <steven-cdist--@--armstrong.cc>
|
2011-03-24 22:16:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
COPYING
|
|
|
|
-------
|
|
|
|
Copyright \(C) 2011 Steven Armstrong. Free use of this software is
|
|
|
|
granted under the terms of the GNU General Public License version 3 (GPLv3).
|