On Feb 29, 2012, at 1:10 PM, Matt Mencel wrote:
> In my network every subnets default gateway is X.X.X.1. That router gateway
> is always running ntpd which I want to give be default as the ntp server in
> every hosts ntp.conf.
>
> Since there is no official "default gateway" fact yet, what I want to be able
> to do in my manifest is take the $ipaddress fact and turn it into the gateway
> for that subnet.
>
> For example...
> IP = 10.1.1.12
> GW = 10.1.1.1
>
> I'm using the puppetlabs-ntp module, so I should be able to do something like
> this in my classes...I think... I just need to know how to get the .1
> address in there...
>
> class mycustomclass:ntp {
> class { "ntp":
> servers => [ DOT_ONE_ADDRESS_FOR_HOSTS_IP_GOES_HERE ],
> autoupdate => false,
> }
> }
>
> If this was raw ruby I could do some string magic to turn the last value to
> 1. I don't know how to do that with the Puppet DSL though.
>
> Thanks,
> Matt
Oh, look. I get to be useful! I've done something similar for my computer
cluster class. I base the ip of the eth4 interface off the ip of eth0, changing
one octet from 39 to 38. Here's the line:
$eth4ip = regsubst($::ipaddress_eth0, '\.39\.', '.38.')
For your purpose, you'd need to do something like this:
$ntpip = regsubst($::ipaddress, '[0-9]+$', '1')
--
Peter M. Bukowinski
Sr. Systems Engineer
Janelia Farm Research Campus, HHMI
--
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.