This works ... or you can just do a simple template if you don't wish to
use the arguments, as Mr. Horvath has done, below (which probably scales a
bit better)... just plug in the right ip address (and network name) for
your second server as-dictated from "facter" on that machine... I've used
10.0.0.1 with an eth0 interface, here.

-- begin resolv.conf.erb
nameserver 1.2.3.4
<% if network_eth0 == '10.0.0.1' -%>
nameserver 5.6.7.8
<% end -%>
-- end


On Thu, Mar 15, 2012 at 1:45 AM, Peter Horvath <[email protected]>wrote:

> Hey,
>
> I am using this to configure resolve conf
> manifest:
> define resolv_conf($domainname = "$domain", $searchpath, $nameservers) {
>        file { "/etc/resolv.conf":
>                owner   => root,
>                group   => root,
>                mode    => 644,
>                content => template("${module_name}/resolv.conf.erb"),
>        }
>
> template:
>
> domain <%= domainname %>
> <% if !searchpath.empty? %>search <%= searchpath.join(" ") %>
> <% end -%>
> <% nameservers.each do |ns| %>nameserver <%= ns %>
> <% end -%>
>
> Node conf:
> resolv_conf { "1":
>                domainname      => "domainname",
>                searchpath      => [ "domainname", 'otherdomainname' ],
>                nameservers     => [ '10.66.3.12', '10.66.3.13' ],
>        }
>
> I hope it helps
>
> On 15 March 2012 08:06, Sharuzzaman Ahmat Raslan <[email protected]>
> wrote:
> > Hi,
> >
> > I was asked by my boss if puppet can handle the following scenario.
> >
> > - 2 server (A and B)
> > - same config for each server, eg. /etc/resolv.conf (nameserver
> > 1.2.3.4)
> > - but B should have a local unique requirement of another nameserver
> > 5.6.7.8
> >
> > so, A will have
> > nameserver 1.2.3.4
> >
> > but B will have
> > nameserver 5.6.7.8
> > nameserver 1.2.3.4
> >
> > when we change the global nameserver 1.2.3.4 to 9.8.7.6, it should
> > become
> >
> > server A
> > nameserver 9.8.7.6
> >
> > server B
> > nameserver 5.6.7.8
> > nameserver 9.8.7.6
> >
> > This should be identical in how Red Hat Satellite is doing locally
> > managed files.
> >
> > See
> >
> http://docs.redhat.com/docs/en-US/Red_Hat_Network_Satellite/5.4/html/Reference_Guide/sect-Reference_Guide-Configuration.html#sect-Reference_Guide-Configuration-Locally_Managed_Files
> >
> > Any hint on how to achive the same thing with Puppet?
> >
> > --
> > 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.
>
>

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