54. cdist-type__line(7)¶
Manage lines in files
Nico Schottelius <nico-cdist--@--schottelius.org>
54.1. DESCRIPTION¶
This cdist type allows you to add lines and remove lines from files.
54.2. REQUIRED PARAMETERS¶
54.3. OPTIONAL PARAMETERS¶
- state
- ‘present’ or ‘absent’, defaults to ‘present’
- line
Specifies the line which should be absent or present
Must be present, if state is present. Must not be combined with regex, if state is absent.
- regex
If state is present, search for this pattern and add given line, if the given regular expression does not match.
In case of absent, ensure all lines matching the regular expression are absent.
The regular expression is interpreted by grep.
Must not be combined with line, if state is absent.
- file
- If supplied, use this as the destination file. Otherwise the object_id is used.
54.4. EXAMPLES¶
# Manage the DAEMONS line in rc.conf
__line daemons --file /etc/rc.conf --line 'DAEMONS=(hwclock !network sshd crond postfix)'
# Ensure the home mount is present in /etc/fstab - explicitly make it present
__line home-fstab \
--file /etc/fstab \
--line 'filer.fs:/vol/home /home nfs defaults 0 0' \
--state present
# Removes the line specifiend in "include_www" from the file "lighttpd.conf"
__line legacy_timezone --file /etc/rc.conf --regex 'TIMEZONE=.*' --state absent
54.5. SEE ALSO¶
- cdist-type(7)
- grep(1)
54.6. COPYING¶
Copyright (C) 2012-2013 Nico Schottelius. Free use of this software is granted under the terms of the GNU General Public License version 3 (GPLv3).