Here''s one way:
1) Install the erwbgy/system module:
# puppet module install erwbgy/system
2) Configure a custom fact using facter_dot_d for the default gateway:
include system::schedules
$config = {
''default_route'' => {
''type'' => ''script'',
''value'' => "#!/bin/bash\nprintf default_route=;
/sbin/ip route show |
/usr/bin/perl -ane ''print \$F[2] if /^default /o''",
}
}
class { ''::system::facts'':
config => $config,
}
3) Create the cron job using this custom fact:
cron { ''mycron'':
command => "/usr/bin/ELFexecutable -g ${default_route}",
hour => 1,
minute => 1,
}
- Keith
On 29 January 2013 14:12, Balasubramaniam Natarajan
<bala150985@gmail.com>wrote:
> Hi
>
> Is there a way for puppet to create cron job on each of my node based on
> my gateway''s IP ?
>
> bala@bala-desktop:~$ route -n
> Kernel IP routing table
> Destination Gateway Genmask Flags Metric Ref Use
> Iface
> 10.0.2.0 0.0.0.0 255.255.255.0 U 1 0 0
> eth0
> 169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0
> eth0
> 0.0.0.0 10.0.2.2 0.0.0.0 UG 0 0 0
> eth0
> bala@bala-desktop:~$
>
> For example if my gateway is 10.0.2.2 then I need to set up a cron job
> like the following, with my gateway being a parameter which I pass to my
> ELFexecutable
>
> 1 1 * * * /usr/bin/ELFexecutable -g 10.0.2.2
>
> For now I can do it to a extent, please let me know if I am on the correct
> path ? Or is there a better way to do it, currently when I list all the
> facter I don''t see any with the gateway address.
>
> --
> Regards,
> Balasubramaniam Natarajan
> www.blog.etutorshop.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscribe@googlegroups.com.
> To post to this group, send email to puppet-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-users+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.