1CDIST-TYPE__LINE(7) cdist CDIST-TYPE__LINE(7)
2
3
4
6 cdist-type__line - Manage lines in files
7
9 This cdist type allows you to add lines and remove lines from files.
10
12 None.
13
15 after Insert the given line after this pattern.
16
17 before Insert the given line before this pattern.
18
19 file If supplied, use this as the destination file. Otherwise the
20 object_id is used.
21
22 line Specifies the line which should be absent or present.
23
24 Must be present, if state is 'present'. Ignored if regex is
25 given and state is 'absent'.
26
27 regex If state is 'present', search for this pattern and if it matches
28 add the given line.
29
30 If state is 'absent', ensure all lines matching the regular
31 expression are absent.
32
33 The regular expression is interpreted by awk's match function.
34
35 state 'present' or 'absent', defaults to 'present'
36
37 onchange
38 The code to run if line is added, removed or updated.
39
41 None.
42
44 added The line was added.
45
46 updated
47 The line or its position was changed.
48
49 removed
50 The line was removed.
51
53 # Manage a hosts entry for www.example.com.
54 __line /etc/hosts \
55 --line '127.0.0.2 www.example.com'
56
57 # Manage another hosts entry for test.example.com.
58 __line hosts:test.example.com \
59 --file /etc/hosts \
60 --line '127.0.0.3 test.example.com'
61
62 # Remove the line starting with TIMEZONE from the /etc/rc.conf file.
63 __line legacy_timezone \
64 --file /etc/rc.conf \
65 --regex 'TIMEZONE=.*' \
66 --state absent
67
68 # Insert a line before another one.
69 __line password-auth-local:classify \
70 --file /etc/pam.d/password-auth-local \
71 --line '-session required pam_exec.so debug log=/tmp/classify.log /usr/local/libexec/classify' \
72 --before '^session[[:space:]]+include[[:space:]]+password-auth-ac$'
73
74 # Insert a line after another one.
75 __line password-auth-local:classify \
76 --file /etc/pam.d/password-auth-local \
77 --line '-session required pam_exec.so debug log=/tmp/classify.log /usr/local/libexec/classify' \
78 --after '^session[[:space:]]+include[[:space:]]+password-auth-ac$'
79
81 cdist-type(7)
82
84 Steven Armstrong <steven-cdist--@--armstrong.cc>
85
87 Copyright (C) 2018 Steven Armstrong. Free use of this software is
88 granted under the terms of the GNU General Public License version 3
89 (GPLv3).
90
92 ungleich GmbH 2019
93
94
95
96
976.4.0 Jan 04, 2020 CDIST-TYPE__LINE(7)