Hi Peter,
with the help of Jerrery, i got the below module and i modified it as per
our requirement. So the below module will create a crontab on root user
right ?
# Generate the times when the cronjob will run
class cron_puppet {
$cron_time1= generate('/usr/bin/env', 'sh', '-c', "printf $(($(echo
$::ipaddress | awk -F . \'{print \$1+\$2+\$3+\$4}\') % 30))")
$cron_time2 = $cron_time1 + 30
cron { 'run-my-puppet-agent':
ensure => present,
command => /usr/local/sbin/puppetd --onetime --no-daemonize >
/dev/null 2>&1,
minute => [$cron_time1, $cron_time2],
user => 'root',
}
}
On Thu, Mar 8, 2012 at 10:58 AM, Peter Berghold <[email protected]>wrote:
> Munna,
>
> Here is a typical module tree:
>
> xinetd/
> |-- manifests
> | `-- init.pp
> `-- templates
>
> I chose this module as my "pattern" for you to look at because it is a
> very simple module.
>
> In your case I'd be creating
> puppetcron/
> `-- manifests
>
> with a single file "init.pp" with a single class:
>
> class puppetcron {
> cron { run-my-puppet-agent:
> minute => "1,31",
> command => "/usr/sbin/puppet agent --test"
> }
> }
>
> Modify the minute parameter for how often you want cron to execute
> puppet. Or add hour, day or whatever to suit your installation.
>
> Of course you going to have to run the agent manually on each host to
> "jumpstart" this process, but there ya have it.
>
> One thought:
>
> If you are running out of cron you run the risk of multiple client systems
> accessing your puppet master all at once. This can become a scaling issue.
> My advice is to just execute "puppet agent" on bootup (or manually) on each
> machine and let them figure out when to talk to the master.
>
>
>
> On Thu, Mar 8, 2012 at 11:38 AM, Munna S <[email protected]> wrote:
>
>> Hi Jeffrey,
>>
>> Thanks for the quick response.
>>
>> I need to copy the below content into init.pp file which is under my
>> module right ? Also i created the module like this.
>>
>> /etc/puppet/modules/cron_puppet
>>
>> also should i define my class in the init.pp file. could you please help
>> me on this. i am getting errors
>>
>> -Jeeva
>>
>>
>>
>> On Thu, Mar 8, 2012 at 9:50 PM, Jeeva <[email protected]> wrote:
>>
>>> We are planning to run the puppet client as a cron rather than running
>>> as a daemon. Could you please help me in creating a module for running
>>> the puppet client as a cron
>>
>>
>> --
>> 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.
>>
>
>
>
> --
> Peter L. Berghold
> Owner, Shark River Technical Solutions LLC
>
> --
> 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.
>
--
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.