Sharuzzaman Ahmat Raslan
2012-Mar-15 08:06 UTC
[Puppet Users] using puppet to configure local settings
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 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.
Peter Horvath
2012-Mar-15 08:45 UTC
Re: [Puppet Users] using puppet to configure local settings
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 <sharuzzaman@gmail.com>
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 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.
>
--
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.
John Kennedy
2012-Mar-15 09:07 UTC
Re: [Puppet Users] using puppet to configure local settings
I am new to puppet so I do not know the syntax for this but I understand it to work. You can ensure that a specific string exists in a file. If not, puppet will insert that string. To remove a string I think is also possible but not 100% sure on that. Another option would be to have puppet just serve the 2 different files in their entirety then edit them on the puppet master as the requirements change. Sorry I can not give details (yet) but hopefully this will give you a place to start. John Kennedy On Thu, Mar 15, 2012 at 08:06, Sharuzzaman Ahmat Raslan < sharuzzaman@gmail.com> 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 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. > >-- 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.
Russell Van Tassell
2012-Mar-15 09:49 UTC
Re: [Puppet Users] using puppet to configure local settings
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 <peter.horvath77@gmail.com>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 <sharuzzaman@gmail.com> > 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 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. > > > > -- > 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. > >-- 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.