You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.markdown
+25-21Lines changed: 25 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ After you've installed stdlib, all of its functions, facts, and resources are av
40
40
41
41
If you want to use a standardized set of run stages for Puppet, `include stdlib` in your manifest.
42
42
43
-
##Reference
43
+
##Reference
44
44
45
45
### Classes
46
46
@@ -75,7 +75,30 @@ If you want to use a standardized set of run stages for Puppet, `include stdlib`
75
75
class { java: stage => 'runtime' }
76
76
}
77
77
```
78
+
79
+
### Resources
78
80
81
+
*`file_line`: This resource ensures that a given line, including whitespace at the beginning and end, is contained within a file. If the line is not contained in the given file, Puppet will add the line. Multiple resources can be declared to manage multiple lines in the same file. You can also use match to replace existing lines.
82
+
83
+
```
84
+
file_line { 'sudo_rule':
85
+
path => '/etc/sudoers',
86
+
line => '%sudo ALL=(ALL) ALL',
87
+
}
88
+
file_line { 'sudo_rule_nopw':
89
+
path => '/etc/sudoers',
90
+
line => '%sudonopw ALL=(ALL) NOPASSWD: ALL',
91
+
}
92
+
```
93
+
94
+
*`after`: Specify the line after which Puppet will add any new lines. (Existing lines are added in place.) Optional.
95
+
*`ensure`: Ensures whether the resource is present. Valid values are 'present', 'absent'.
96
+
*`line`: The line to be added to the file located by the `path` parameter.
97
+
*`match`: A regular expression to run against existing lines in the file; if a match is found, we replace that line rather than adding a new line. Optional.
98
+
*`multiple`: Determine if match can change multiple lines. Valid values are 'true', 'false'. Optional.
99
+
*`name`: An arbitrary name used as the identity of the resource.
100
+
*`path`: The file in which Puppet will ensure the line specified by the line parameter.
101
+
79
102
### Functions
80
103
81
104
*`abs`: Returns the absolute value of a number; for example, '-34.56' becomes '34.56'. Takes a single integer and float value as an argument. *Type*: rvalue
@@ -165,25 +188,6 @@ also appear in the second array. For example, `difference(["a","b","c"],["b","c"
165
188
166
189
*Type*: statement
167
190
168
-
*`file_line`: This resource ensures that a given line is contained within a file. You can also use match to replace existing lines.
169
-
170
-
*Example:*
171
-
172
-
```
173
-
file_line { 'sudo_rule':
174
-
path => '/etc/sudoers',
175
-
line => '%sudo ALL=(ALL) ALL',
176
-
}
177
-
178
-
file_line { 'change_mount':
179
-
path => '/etc/fstab',
180
-
line => '10.0.0.1:/vol/data /opt/data nfs defaults 0 0',
181
-
match => '^172.16.17.2:/vol/old',
182
-
}
183
-
```
184
-
185
-
*Type*: resource
186
-
187
191
*`flatten`: This function flattens any deeply nested arrays and returns a single flat array as a result. For example, `flatten(['a', ['b', ['c']]])` returns ['a','b','c']. *Type*: rvalue
188
192
189
193
*`floor`: Returns the largest integer less than or equal to the argument.
@@ -321,7 +325,7 @@ returns the value of the resource's parameter. For example, the following code r
321
325
322
326
*`max`: Returns the highest value of all arguments. Requires at least one argument. *Type*: rvalue
323
327
324
-
*`member`: This function determines if a variable is a member of an array. For example, `member(['a','b'], 'b')`returns 'true', while `member(['a','b'], 'c')`returns 'false'. *Type*: rvalue
328
+
*`member`: This function determines if a variable is a member of an array. The variable can be either a string, array, or fixnum. For example, `member(['a','b'], 'b')`and `member(['a','b','c'], ['b','c'])` return 'true', while `member(['a','b'], 'c')`and `member(['a','b','c'], ['c','d'])` return 'false'. *Type*: rvalue
325
329
326
330
*`merge`: Merges two or more hashes together and returns the resulting hash.
0 commit comments