On Nov 4, 2011, at 11:42 AM, Arenstar wrote:

> Simply put..
> 
> I need the reverse of an ipaddress for a in-addr.arpa..
> Puppet has a function i can find that will simply execute ruby code,
> nor bash..
> $ipaddress comes from facter
> 
> $reversenetwork = $ipaddress.split('.')[0,3].reverse.join('.')
> 
> file { "/opt/lp/dnscache-internal/root/servers/$reversenetwork.in-
> addr.arpa":
>        owner   => root,
>        group   => root,
>        mode    => 644,
>        content => "127.0.0.1 \n",
>        require => Exec["dnscache-internal-setup"],
> }
> 
> Can anyone help..
> ive tried, inline_templates and now working with facter..
> Its much too overly complicated for my needs.. i dont want to have to
> manage facter unless its absolutely neccessary
> and for a simple line of ruby, i cant see why it will not work..
> 
> Suggestions...
----
facter - should be about as simple as (untested)...

/etc/puppet/modules/custom/lib/facter/in_arpa.rb
Facter.add("reversenetwork") do
  setcode do
    reversenetwork = Facter.value(:ipaddress).split('.')[0,3].reverse.join('.')
    reversenetwork
  end
end

and then you have $reversenetwork fact that you can use easily

Craig

-- 
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.

Reply via email to