Ok that seems to be the problem but it's apparently still not fixed in 2.6.3
on Solaris.
I did figure out more on this issue, it seems that if you are managing a
cron entry for a user that does not yet exist puppet nukes all the current
entries for any cron jobs it's currently managing for existing users. Once
all users exist everything works as expected.
Since the cronjob pre-fetch occurs before the user(s) get added it always
happens the first time you run puppet on a new host and doesn't seem to keep
a backup of the original crontab.
Overview:
1. Manage crontab entry for user 'root'
2. Manage crontab entry for user 'monitor'
3. Tell puppet to create user and group monitor first using the Require
syntax on the cron service
4. Puppet does a crontab prefetch and gets an error for the monitor user
which does not yet exist
5. Root's crontab get's cleaned out and only puppet entry exists now
6. Monitor crontab get's created properly after puppet creates monitor
user/group.
7. Once all users exist that have managed cron jobs the problem stops
happening for all users.
My debug output relevant to problem::
debug: Prefetching crontab resources for cron
debug: Executing 'crontab -l'
debug: Executing 'crontab -l'
err: Could not prefetch cron provider 'crontab': Could not read crontab for
monitor: Invalid user: monitor
Actual code::
import "*"
class coresystems {
include coresystems::base_users
include coresystems::cron
include coresystems::cron::monitor
}
class coresystems::base_users {
user { 'monitor':
uid => '472',
gid => '472',
home => '/tmp',
shell => '/bin/bash',
password => 'NP',
ensure => 'present',
require => Group['monitor'],
}
group { 'monitor':
gid => '472',
ensure => 'present',
}
}
class coresystems::cron {
# Unique time in the range of 0-59 per node name..
$minute = fqdn_rand(59)
$puppet_binary = "/usr/bin/puppet"
if $minute > 29
{
$minute2 = $minute - 30
}
else
{
$minute2 = $minute + 30
}
cron { "manual-puppet":
command => "$puppet_binary agent --onetime --no-daemonize --logdest
syslog > /dev/null 2>&1",
user => "root",
hour => "*",
minute => [$minute, $minute2],
ensure => present,
}
}
class coresystems::cron::monitor {
cron { "myjob":
command => "/opt/bin/mon.pl",
user => "monitor",
hour => "*",
minute => [0,5,10,15,20,25,30,35,40,45,50,55],
ensure => present,
require => User['monitor'],
}
}
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.