Skip to content

Commit a0a92f9

Browse files
author
Pete Brown
committed
Merge pull request #14 from Ueeu/master
Ability to insert free-text lines to sudoers
2 parents 37240cc + 09251fd commit a0a92f9

3 files changed

Lines changed: 42 additions & 0 deletions

File tree

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,30 @@ Host or array of hosts in this group
188188

189189
Description of this host group
190190

191+
sudo::line { "Icinga-no-tty":
192+
ensure => present, # whether the rule should exist or not (present is the default)
193+
line => 'Defaults:icinga !requiretty', # can also be an array of hosts
194+
comment => "enable access for icinga without requiring tty",
195+
}
196+
197+
### sudo::line
198+
199+
This type manages pre-formatted lines to be inserted to sudoers
200+
201+
**Parameters within sudo::line**
202+
203+
#### `ensure`
204+
205+
Whether the specific line should exist or not (present is the default)
206+
207+
#### `line`
208+
209+
Optional content of the line to be managed
210+
211+
#### `comment`
212+
213+
Optional description which is inserted befor the line
214+
191215
sudo::runas { "whoever":
192216
ensure => present, # whether the rule should exist or not (present is the default)
193217
who => 'bob', # can also be an array of users

manifests/line.pp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
define sudo::line (
2+
$line,
3+
$ensure = present,
4+
$comment = undef,
5+
) {
6+
7+
sudo::register{"line_${name}":
8+
ensure => $ensure,
9+
content => template('sudo/line.erb'),
10+
}
11+
}

templates/line.erb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<% if @comment -%>
2+
#
3+
# <%= @comment %>
4+
<% end -%>
5+
<% if @line -%>
6+
<%= @line %>
7+
<% end -%>

0 commit comments

Comments
 (0)