Ok , so this was actually two problems...
The first , can't have quotes around the folder location in
#includedir...
Second is the way I was populating those files...
Here's the sudo module definition...
define sudo::directive (
$ensure=present,
$content="",
$source=""
) {
# sudo skipping file names that contain a "."
$dname = regsubst($name, '\.', '-', 'G')
file {"/etc/sudoers.d/${dname}":
ensure => $ensure,
owner => root,
group => root,
mode => 0440,
content => $content ? {
"" => undef,
default => $content,
},
source => $source ? {
"" => undef,
default => $source,
},
require => Package["sudo"],
}
}
The "content" method doesn't work, or at least not in the way I've
implemented it...
So this doesn't work...
sudo::directive { "zabbix-puppet":
ensure => present,
content => "zabbix ALL=NOPASSWD: /var/lib/zabbix/bin/
start_puppet",
#source => "puppet:///files/zabbix_sudocmd",
}
And this works...
sudo::directive { "zabbix-puppet":
ensure => present,
#content => "zabbix ALL=NOPASSWD: /var/lib/zabbix/bin/
start_puppet",
source => "puppet:///files/zabbix_sudocmd",
}
The file "zabbix_sudocmd" contains the same text as the "Content"
line, however it seems to not add a necessary new line character, as
this is the debug output from puppet when I change from "source" to
"content"...
debug: /Stage[main]/Role_zabbix_client/Sudo::Directive[zabbix-puppet]/
File[/etc/sudoers.d/zabbix-puppet]/content: Executing 'diff -u /etc/
sudoers.d/zabbix-puppet /tmp/puppet-file20110801-18801-1wfv1td-0'
--- /etc/sudoers.d/zabbix-puppet 2011-08-01 18:45:16.248138294 -0500
+++ /tmp/puppet-file20110801-18801-1wfv1td-0 2011-08-01
18:53:53.566133754 -0500
@@ -1 +1 @@
-zabbix ALL=NOPASSWD: /var/lib/zabbix/bin/start_puppet
+zabbix ALL=NOPASSWD: /var/lib/zabbix/bin/start_puppet
\ No newline at end of file
debug: file_bucket_file supports formats: b64_zlib_yaml marshal pson
raw yaml; using yaml
info: /Stage[main]/Role_zabbix_client/Sudo::Directive[zabbix-puppet]/
File[/etc/sudoers.d/zabbix-puppet]: Filebucketed /etc/sudoers.d/zabbix-
puppet to main with sum 2ecb3670db9e458970153bf00d64b325
notice: /Stage[main]/Role_zabbix_client/Sudo::Directive[zabbix-puppet]/
File[/etc/sudoers.d/zabbix-puppet]/content: content changed '{md5}
2ecb3670db9e458970153bf00d64b325' to '{md5}
348da8bc5d9eacaf6334b092d95001eb'
Notice the "No newline at end of file"...
I can use "content" if I add a "\n" to the end of the line, which
doesn't seem like it should be necessary, but it works.
Thanks!!
- Trey