So I''ve decided to use crontab for all my puppet clients rather than the daemon. I''ve set-up a puppetmaster with seven puppet clients. I''m using the following pattern: class cron { $minute = generate(''/usr/bin/env'', ''sh'', ''-c'', ''printf $((RANDOM %60+0))'') cron { "manual-puppet": command => "/usr/sbin/puppetd --server=ps-dev-web1 --logdest=/ var/log/puppet/puppet.log --verbose --onetime --no-daemonize", user => "root", hour => "*", minute => $minute, ensure => present, } } Six of the puppet clients are running the cronjob just fine at random intervals, except one. The thing about this host is that if I run the crontab entry command manually, it''s successful: [root@ps-dev-app1 puppet]# /usr/sbin/puppetd --server=ps-dev-web1 -- logdest=/var/log/puppet/puppet.log --verbose --onetime --no-daemonize info: Caching catalog for ps-dev-app1.plansourcedev.com info: Applying configuration version ''1282328744'' notice: /Stage[main]/Cron/Cron[manual-puppet]/minute: minute changed ''5'' to ''31'' notice: /Stage[main]/Cron/Cron[manual-puppet]/hour: defined ''hour'' as ''*'' notice: Finished catalog run in 0.39 seconds However, when I run this through crontab, nothing happens. Here''s what the /var/log/cron shows, when it executes the command through crontab: Aug 23 16:01:01 ps-dev-app1 crond[16367]: (root) CMD (/usr/sbin/ puppetd --server=ps-dev-web1 --logdest=/var/log/puppet/puppet.log -- verbose --debug --onetime --no-daemonize) And although the command seems to execute through crontab, there''s no evidence of this otherwise. For one, the "/var/log/puppet.log" does not get created or append to existing log. The crontab entry should also reflect a change in interval time, but there''s no evidence of this either. I''ve tried several different things, including removing the crontab file - "crontab -r" and re-running the command manually to re-create the crontab entry. I''ve, verified, my crond is running normally, by running random commands and verifying they executed through cron. It would seem only "puppetd" is not success at running through crontab. Fortunately, only one of my puppet clients is experiencing this issue. Anyone have an idea of what could be perpetuating this behavior ? Thanks. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On 8/23/10 9:15 AM, Franck wrote:> So I''ve decided to use crontab for all my puppet clients rather than > the daemon. I''ve set-up a puppetmaster with seven puppet clients. > > I''m using the following pattern: > > class cron { > $minute = generate(''/usr/bin/env'', ''sh'', ''-c'', ''printf $((RANDOM > %60+0))'') > > cron { "manual-puppet": > command => "/usr/sbin/puppetd --server=ps-dev-web1 --logdest=/ > var/log/puppet/puppet.log --verbose --onetime --no-daemonize", > user => "root", > hour => "*", > minute => $minute, > ensure => present, > } > }Have you considered using the --splay & --splaylimit options built into puppet rather than constantly editing the crontab? http://docs.puppetlabs.com/references/stable/configuration.html?action=diff&version=41#splay> > Six of the puppet clients are running the cronjob just fine at random > intervals, except one. The thing about this host is that if I run the > crontab entry command manually, it''s successful: > > [root@ps-dev-app1 puppet]# /usr/sbin/puppetd --server=ps-dev-web1 -- > logdest=/var/log/puppet/puppet.log --verbose --onetime --no-daemonize > info: Caching catalog for ps-dev-app1.plansourcedev.com > info: Applying configuration version ''1282328744'' > notice: /Stage[main]/Cron/Cron[manual-puppet]/minute: minute changed > ''5'' to ''31'' > notice: /Stage[main]/Cron/Cron[manual-puppet]/hour: defined ''hour'' as > ''*'' > notice: Finished catalog run in 0.39 seconds > > > However, when I run this through crontab, nothing happens. > Here''s what the /var/log/cron shows, when it executes the command > through crontab: > Aug 23 16:01:01 ps-dev-app1 crond[16367]: (root) CMD (/usr/sbin/ > puppetd --server=ps-dev-web1 --logdest=/var/log/puppet/puppet.log -- > verbose --debug --onetime --no-daemonize)> And although the command seems to execute through crontab, there''s no > evidence of this otherwise. For one, the "/var/log/puppet.log" does > not get created or append to existing log. The crontab entry should > also reflect a change in interval time, but there''s no evidence of > this either.Maybe just a typo, but the command you are running shows the puppet.log should be created in /var/log/puppet/puppet.log but you are looking in /var/log/puppet.log. Perhaps there is a permission issue or /var/log/puppet/ does not exist?> I''ve tried several different things, including removing the crontab > file - "crontab -r" and re-running the command manually to re-create > the crontab entry. I''ve, verified, my crond is running normally, by > running random commands and verifying they executed through cron. It > would seem only "puppetd" is not success at running through > crontab. > > Fortunately, only one of my puppet clients is experiencing this > issue. > > Anyone have an idea of what could be perpetuating this behavior ? > > Thanks. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
I have not considered --splay, but I definitely will give that a shot. I meant that the puppet.log was to be created in the /var/log/puppet directory, that was a typo. Thanks Brandon. On Aug 23, 5:23 pm, Brandon Evans <bev...@adicio.com> wrote:> On 8/23/10 9:15 AM, Franck wrote: > > > > > > > So I''ve decided to use crontab for all my puppet clients rather than > > the daemon. I''ve set-up a puppetmaster with seven puppet clients. > > > I''m using the following pattern: > > > class cron { > > $minute = generate(''/usr/bin/env'', ''sh'', ''-c'', ''printf $((RANDOM > > %60+0))'') > > > cron { "manual-puppet": > > command => "/usr/sbin/puppetd --server=ps-dev-web1 --logdest=/ > > var/log/puppet/puppet.log --verbose --onetime --no-daemonize", > > user => "root", > > hour => "*", > > minute => $minute, > > ensure => present, > > } > > } > > Have you considered using the --splay & --splaylimit options built into > puppet rather than constantly editing the crontab? > > http://docs.puppetlabs.com/references/stable/configuration.html?actio... > > > > > > > > > Six of the puppet clients are running the cronjob just fine at random > > intervals, except one. The thing about this host is that if I run the > > crontab entry command manually, it''s successful: > > > [root@ps-dev-app1 puppet]# /usr/sbin/puppetd --server=ps-dev-web1 -- > > logdest=/var/log/puppet/puppet.log --verbose --onetime --no-daemonize > > info: Caching catalog for ps-dev-app1.plansourcedev.com > > info: Applying configuration version ''1282328744'' > > notice: /Stage[main]/Cron/Cron[manual-puppet]/minute: minute changed > > ''5'' to ''31'' > > notice: /Stage[main]/Cron/Cron[manual-puppet]/hour: defined ''hour'' as > > ''*'' > > notice: Finished catalog run in 0.39 seconds > > > However, when I run this through crontab, nothing happens. > > Here''s what the /var/log/cron shows, when it executes the command > > through crontab: > > Aug 23 16:01:01 ps-dev-app1 crond[16367]: (root) CMD (/usr/sbin/ > > puppetd --server=ps-dev-web1 --logdest=/var/log/puppet/puppet.log -- > > verbose --debug --onetime --no-daemonize) > > And although the command seems to execute through crontab, there''s no > > evidence of this otherwise. For one, the "/var/log/puppet.log" does > > not get created or append to existing log. The crontab entry should > > also reflect a change in interval time, but there''s no evidence of > > this either. > > Maybe just a typo, but the command you are running shows the puppet.log > should be created in /var/log/puppet/puppet.log but you are looking in > /var/log/puppet.log. Perhaps there is a permission issue or > /var/log/puppet/ does not exist? > > > > > I''ve tried several different things, including removing the crontab > > file - "crontab -r" and re-running the command manually to re-create > > the crontab entry. I''ve, verified, my crond is running normally, by > > running random commands and verifying they executed through cron. It > > would seem only "puppetd" is not success at running through > > crontab. > > > Fortunately, only one of my puppet clients is experiencing this > > issue. > > > Anyone have an idea of what could be perpetuating this behavior ? > > > Thanks.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Franck <ffallateuf@gmail.com> writes:> So I''ve decided to use crontab for all my puppet clients rather than > the daemon. I''ve set-up a puppetmaster with seven puppet clients. > > I''m using the following pattern: > > class cron { > $minute = generate(''/usr/bin/env'', ''sh'', ''-c'', ''printf $((RANDOM > %60+0))'')$minute = fqdn_rand(59) That generates a random, but consistent, number in the 0-59 range based on the name of the host. This will give some spread, but not the complete randomness of the method above. Daniel -- ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Mon, Aug 23, 2010 at 4:54 PM, Daniel Pittman <daniel@rimspace.net> wrote:> Franck <ffallateuf@gmail.com> writes: > >> So I''ve decided to use crontab for all my puppet clients rather than >> the daemon. I''ve set-up a puppetmaster with seven puppet clients. >> >> I''m using the following pattern: >> >> class cron { >> $minute = generate(''/usr/bin/env'', ''sh'', ''-c'', ''printf $((RANDOM >> %60+0))'') > > $minute = fqdn_rand(59) > > That generates a random, but consistent, number in the 0-59 range based on the > name of the host. This will give some spread, but not the complete randomness > of the method above. > > DanielThis seems overly complicated. Why not just have a bash wrapper script execute from cron and execute puppetd for you: #! /bin/bash sleep $((RANDOM % 600)) exec puppetd $@ -- Jeff McCune http://www.puppetlabs.com/ -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jeff McCune <jeff@puppetlabs.com> writes:> On Mon, Aug 23, 2010 at 4:54 PM, Daniel Pittman <daniel@rimspace.net> wrote: >> Franck <ffallateuf@gmail.com> writes: >> >>> So I''ve decided to use crontab for all my puppet clients rather than >>> the daemon. I''ve set-up a puppetmaster with seven puppet clients. >>> >>> I''m using the following pattern: >>> >>> class cron { >>> $minute = generate(''/usr/bin/env'', ''sh'', ''-c'', ''printf $((RANDOM >>> %60+0))'') >> >> $minute = fqdn_rand(59) >> >> That generates a random, but consistent, number in the 0-59 range based on the >> name of the host. This will give some spread, but not the complete randomness >> of the method above. > > This seems overly complicated. Why not just have a bash wrapper script > execute from cron and execute puppetd for you:If you were going to do that, using splay might also make sense[1]. However, that was already suggested earlier in the thread, and it doesn''t give you a predictable runtime for each node. Personally, I would favour using the mcollective puppet execution director to trigger off running on your nodes, but that is much, much further from where the OP wanted to be and all. :) Daniel Footnotes: [1] ...though it would presumably tie up more memory for longer, since puppetd has a larger footprint than sleep(1) does. -- ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Another options which I''ve used successfully in the past is: http://projects.puppetlabs.com/projects/puppet/wiki/Cron_Patterns - see the section title: Setting Cron using a Puppet custom function One important thing to note is that when you get a random value, puppet will change it on each puppet run. Ohad On Tue, Aug 24, 2010 at 2:54 AM, Daniel Pittman <daniel@rimspace.net> wrote:> Franck <ffallateuf@gmail.com> writes: > > > So I''ve decided to use crontab for all my puppet clients rather than > > the daemon. I''ve set-up a puppetmaster with seven puppet clients. > > > > I''m using the following pattern: > > > > class cron { > > $minute = generate(''/usr/bin/env'', ''sh'', ''-c'', ''printf $((RANDOM > > %60+0))'') > > $minute = fqdn_rand(59) > > That generates a random, but consistent, number in the 0-59 range based on > the > name of the host. This will give some spread, but not the complete > randomness > of the method above. > > Daniel > > -- > ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 > 707 > ♽ made with 100 percent post-consumer electrons > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > . > 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
As puppet will change the cron object at each run, use something that is different per machine, but the same for the same machine: its IP. Use ipaddress fact. Here two ideas to get this value # Get the last IP digit $digits = split($ipaddress) # Modulo 60 $minute = inline_template("<%= digits[3] % 60 %>") Aurélien Franck a écrit :> So I''ve decided to use crontab for all my puppet clients rather than > the daemon. I''ve set-up a puppetmaster with seven puppet clients. > > I''m using the following pattern: > > class cron { > $minute = generate(''/usr/bin/env'', ''sh'', ''-c'', ''printf $((RANDOM > %60+0))'') > > cron { "manual-puppet": > command => "/usr/sbin/puppetd --server=ps-dev-web1 --logdest=/ > var/log/puppet/puppet.log --verbose --onetime --no-daemonize", > user => "root", > hour => "*", > minute => $minute, > ensure => present, > } > } > > > Six of the puppet clients are running the cronjob just fine at random > intervals, except one. The thing about this host is that if I run the > crontab entry command manually, it''s successful: > > [root@ps-dev-app1 puppet]# /usr/sbin/puppetd --server=ps-dev-web1 -- > logdest=/var/log/puppet/puppet.log --verbose --onetime --no-daemonize > info: Caching catalog for ps-dev-app1.plansourcedev.com > info: Applying configuration version ''1282328744'' > notice: /Stage[main]/Cron/Cron[manual-puppet]/minute: minute changed > ''5'' to ''31'' > notice: /Stage[main]/Cron/Cron[manual-puppet]/hour: defined ''hour'' as > ''*'' > notice: Finished catalog run in 0.39 seconds > > > However, when I run this through crontab, nothing happens. > Here''s what the /var/log/cron shows, when it executes the command > through crontab: > Aug 23 16:01:01 ps-dev-app1 crond[16367]: (root) CMD (/usr/sbin/ > puppetd --server=ps-dev-web1 --logdest=/var/log/puppet/puppet.log -- > verbose --debug --onetime --no-daemonize) > > And although the command seems to execute through crontab, there''s no > evidence of this otherwise. For one, the "/var/log/puppet.log" does > not get created or append to existing log. The crontab entry should > also reflect a change in interval time, but there''s no evidence of > this either. > > I''ve tried several different things, including removing the crontab > file - "crontab -r" and re-running the command manually to re-create > the crontab entry. I''ve, verified, my crond is running normally, by > running random commands and verifying they executed through cron. It > would seem only "puppetd" is not success at running through > crontab. > > Fortunately, only one of my puppet clients is experiencing this > issue. > > Anyone have an idea of what could be perpetuating this behavior ? > > Thanks. >-- Aurelien Degremont CEA -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Ohad Levy <ohadlevy@gmail.com> writes:> Another options which I''ve used successfully in the past is: > http://projects.puppetlabs.com/projects/puppet/wiki/Cron_Patterns - see the > section title: Setting Cron using a Puppet custom function > > One important thing to note is that when you get a random value, puppet will > change it on each puppet run....but not, to be clear, the result of the fqdn_rand function, which does something pretty similar to what you are proposing here with a custom function. Is there some extra benefit to the model you suggest over fqdn_rand? Daniel -- ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Tue, Aug 24, 2010 at 3:29 PM, Daniel Pittman <daniel@rimspace.net> wrote:> Ohad Levy <ohadlevy@gmail.com> writes: > > > Another options which I''ve used successfully in the past is: > > http://projects.puppetlabs.com/projects/puppet/wiki/Cron_Patterns - see > the > > section title: Setting Cron using a Puppet custom function > > > > One important thing to note is that when you get a random value, puppet > will > > change it on each puppet run. > > ...but not, to be clear, the result of the fqdn_rand function, which does > something pretty similar to what you are proposing here with a custom > function. > > Is there some extra benefit to the model you suggest over fqdn_rand? > > it allows you to define different time intervals, e.g. you want to run it 3times an hour with random values, so it will automatically return an array of 3 "random" numbers. Ohad -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Thanks for that tip Daniel. I went ahead and switched to use the "fqdn_rand" function as it''s a lot more consistent which is what I wanted. I''m new to Puppet so I''m still learning some of the functions that can be used. On Aug 23, 7:54 pm, Daniel Pittman <dan...@rimspace.net> wrote:> Franck <ffallat...@gmail.com> writes: > > So I''ve decided to use crontab for all my puppet clients rather than > > the daemon. I''ve set-up a puppetmaster with seven puppet clients. > > > I''m using the following pattern: > > > class cron { > > $minute = generate(''/usr/bin/env'', ''sh'', ''-c'', ''printf $((RANDOM > > %60+0))'') > > $minute = fqdn_rand(59) > > That generates a random, but consistent, number in the 0-59 range based on the > name of the host. This will give some spread, but not the complete randomness > of the method above. > > Daniel > > -- > ✣ Daniel Pittman ✉ dan...@rimspace.net ☎ +61 401 155 707 > ♽ made with 100 percent post-consumer electrons-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Yes, I did take that into account when using the original function''s implementation. But the issue wasn''t residing with that, rather one the puppet clients is not executing through cron. On Aug 24, 5:43 am, Ohad Levy <ohadl...@gmail.com> wrote:> Another options which I''ve used successfully in the past is:http://projects.puppetlabs.com/projects/puppet/wiki/Cron_Patterns- see the > section title: Setting Cron using a Puppet custom function > > One important thing to note is that when you get a random value, puppet will > change it on each puppet run. > > Ohad > > On Tue, Aug 24, 2010 at 2:54 AM, Daniel Pittman <dan...@rimspace.net> wrote: > > Franck <ffallat...@gmail.com> writes: > > > > So I''ve decided to use crontab for all my puppet clients rather than > > > the daemon. I''ve set-up a puppetmaster with seven puppet clients. > > > > I''m using the following pattern: > > > > class cron { > > > $minute = generate(''/usr/bin/env'', ''sh'', ''-c'', ''printf $((RANDOM > > > %60+0))'') > > > $minute = fqdn_rand(59) > > > That generates a random, but consistent, number in the 0-59 range based on > > the > > name of the host. This will give some spread, but not the complete > > randomness > > of the method above. > > > Daniel > > > -- > > ✣ Daniel Pittman ✉ dan...@rimspace.net ☎ +61 401 155 > > 707 > > ♽ made with 100 percent post-consumer electrons > > > -- > > You received this message because you are subscribed to the Google Groups > > "Puppet Users" group. > > To post to this group, send email to puppet-users@googlegroups.com. > > To unsubscribe from this group, send email to > > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > > . > > 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.