Robert Scheer
2010-Nov-01 17:51 UTC
[Puppet Users] Does puppetmaster knows its own configuration parameters?
Hi, I have set up a puppetmaster test server where I can test new releases of puppet before upgrading our puppetmaster production server. It works, but there is one issue I''d like to solve: The puppet.conf for all nodes (except the puppetmasters) is managed by puppet (in modules/puppet/files/puppet.conf) because it needs to contain the fqdn of our puppetmaster server: puppetmaster.ourdomain.com. But every time I export our puppet code repository from subversion to the test server, I have to manually modify the server name in that file to puppetmaster-test.ourdomain.com. If I don''t, then a test-node connecting to the test server, will receive a puppet.conf with the production server name, and subsequent puppet runs will connect to that server instead of my test server. As a solution I tried templating puppet.conf but cannot figure out what variable to use to fill in the current puppet server name. I could solve that by making a custom fact, but besides the huge overhead of "puppetd --configprint server" running every 30 minutes on every node, it is just weird for a server to have to ask the client for its own name. So I''d really like to fix this in puppet code on the masters only. Is there a way to access the local configuration parameter ''server'' within puppet? Or is there another, better solution I am missing? Regards, Robert Scheer -- 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.
Patrick
2010-Nov-01 20:07 UTC
Re: [Puppet Users] Does puppetmaster knows its own configuration parameters?
On Nov 1, 2010, at 10:51 AM, Robert Scheer wrote:> Hi, > > I have set up a puppetmaster test server where I can test new releases > of puppet before upgrading our puppetmaster production server. > It works, but there is one issue I''d like to solve: > > The puppet.conf for all nodes (except the puppetmasters) is managed by > puppet (in modules/puppet/files/puppet.conf) because it needs to contain > the fqdn of our puppetmaster server: puppetmaster.ourdomain.com. > But every time I export our puppet code repository from subversion to > the test server, I have to manually modify the server name in that file > to puppetmaster-test.ourdomain.com. If I don''t, then a test-node connecting > to the test server, will receive a puppet.conf with the production server > name, and subsequent puppet runs will connect to that server instead of > my test server. > > As a solution I tried templating puppet.conf but cannot figure out what > variable to use to fill in the current puppet server name. > > I could solve that by making a custom fact, but besides the huge overhead > of "puppetd --configprint server" running every 30 minutes on every node, > it is just weird for a server to have to ask the client for its own name. > > So I''d really like to fix this in puppet code on the masters only. > Is there a way to access the local configuration parameter ''server'' > within puppet? Or is there another, better solution I am missing?This isn''t a very good answer, but the variable "$servername" contains the name of the server the client think''s it''s connecting to. That may do what you want. -- 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.
Felix Frank
2010-Nov-02 09:24 UTC
Re: [Puppet Users] Does puppetmaster knows its own configuration parameters?
On 11/01/2010 06:51 PM, Robert Scheer wrote:> ... > I could solve that by making a custom fact, but besides the huge overhead > of "puppetd --configprint server" running every 30 minutes on every node, > it is just weird for a server to have to ask the client for its own name. > > So I''d really like to fix this in puppet code on the masters only. > Is there a way to access the local configuration parameter ''server'' > within puppet? Or is there another, better solution I am missing?Sounds to me as though you had finally found a use for the generate function, e.g. $master_host = generate("dnsdomainname -f"). http://docs.puppetlabs.com/references/stable/function.html#generate ;-) Just kidding, it''s a useful feature alright. Maybe it will help you. Regards, Felix -- 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.
Alan Barrett
2010-Nov-02 12:03 UTC
Re: [Puppet Users] Does puppetmaster knows its own configuration parameters?
On Mon, 01 Nov 2010, Robert Scheer wrote:> Is there a way to access the local configuration parameter ''server'' > within puppet? Or is there another, better solution I am missing?See issue 2807 <http://projects.puppetlabs.com/issues/2807>. In puppet-2.6, you can say $server = $settings::server In version 0.25, you can say $server = inline_template("<%= Puppet.settings[:server] %>"). --apb (Alan Barrett) -- 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.
Robert Scheer
2010-Nov-02 16:09 UTC
Re: [Puppet Users] Does puppetmaster knows its own configuration parameters?
On Mon, Nov 01, 2010 at 13:07 -0700, Patrick wrote:> This isn''t a very good answer, but the variable "$servername" contains the name of the server the client think''s it''s connecting to. That may do what you want.This is a very good answer! Thank you. Where in the documentation did you find this? It doesn''t seem to be a standard fact from facter: it doesn''t show up in $vardir/yaml/facts/*.yaml on the master. Robert Scheer XS4ALL Systeembeheer -- 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.
Robert Scheer
2010-Nov-02 16:12 UTC
Re: [Puppet Users] Does puppetmaster knows its own configuration parameters?
On Tue, Nov 02, 2010 at 10:24 +0100, Felix Frank wrote:> Sounds to me as though you had finally found a use for the generate > function, e.g. $master_host = generate("dnsdomainname -f"). > > http://docs.puppetlabs.com/references/stable/function.html#generate > > ;-) Just kidding, it''s a useful feature alright. Maybe it will help you.Thanks, I now remember seeing that function a long time ago in the puppet documentation, but couldn''t imagine in what situation that would be useful. This is one :-) Robert Scheer XS4ALL Systeembeheer -- 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.
Patrick
2010-Nov-02 16:21 UTC
Re: [Puppet Users] Does puppetmaster knows its own configuration parameters?
On Nov 2, 2010, at 9:09 AM, Robert Scheer wrote:> On Mon, Nov 01, 2010 at 13:07 -0700, Patrick wrote: > >> This isn''t a very good answer, but the variable "$servername" contains the name of the server the client think''s it''s connecting to. That may do what you want. > > This is a very good answer! Thank you. Where in the documentation did you > find this? It doesn''t seem to be a standard fact from facter: it doesn''t > show up in $vardir/yaml/facts/*.yaml on the master.Actually, I seem to have it backwards. Looks like $servername is the server-side config variable which is why you can''t find it. Alan Barrett seems to have a solution for getting the client side config. On the other hand, if your DNS is configured right, $servername should work too. -- 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.
Robert Scheer
2010-Nov-03 14:32 UTC
Re: [Puppet Users] Does puppetmaster knows its own configuration parameters?
On Tue, Nov 02, 2010 at 09:21 -0700, Patrick wrote:> Actually, I seem to have it backwards. Looks like $servername is the server-side config variable which is why you can''t find it. Alan Barrett seems to have a solution for getting the client side config. On the other hand, if your DNS is configured right, $servername should work too.Ah, now I know the variable name, I found out where this information comes from: http://projects.puppetlabs.com/projects/puppet/wiki/Frequently_Asked_Questions#Are+there+variables+available+other+than+those+provided+by+Facter? My bad for not checking the FAQ. I expected to find this kind of information in the official documentation (docs.puppetlabs.com) Thanks again! Robert Scheer XS4ALL Systeembeheer -- 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.
Robert Scheer
2010-Nov-03 14:37 UTC
Re: [Puppet Users] Does puppetmaster knows its own configuration parameters?
On Tue, Nov 02, 2010 at 14:03 +0200, Alan Barrett wrote:> In version 0.25, you can say > > $server = inline_template("<%= Puppet.settings[:server] %>").Thanks! Puppet.settings[:server] is exactly what I was looking for. I had tried variations of server, puppet.server and search(), but failed. Do you know where in the documentation or in the wiki could I have found this? Robert Scheer XS4ALL Systeembeheer -- 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.
Nigel Kersten
2010-Nov-03 15:37 UTC
Re: [Puppet Users] Does puppetmaster knows its own configuration parameters?
On Wed, Nov 3, 2010 at 7:32 AM, Robert Scheer <rj@xs4all.net> wrote:> On Tue, Nov 02, 2010 at 09:21 -0700, Patrick wrote: > >> Actually, I seem to have it backwards. Looks like $servername is the server-side config variable which is why you can''t find it. Alan Barrett seems to have a solution for getting the client side config. On the other hand, if your DNS is configured right, $servername should work too. > > Ah, now I know the variable name, I found out where this information > comes from: > http://projects.puppetlabs.com/projects/puppet/wiki/Frequently_Asked_Questions#Are+there+variables+available+other+than+those+provided+by+Facter? > > My bad for not checking the FAQ. I expected to find this kind of > information in the official documentation (docs.puppetlabs.com) > Thanks again!As always, if you find bugs in the documentation, please feel free to either supply patches or simply report the bugs. http://projects.puppetlabs.com/projects/puppet-docs https://github.com/puppetlabs/puppet-docs> > Robert Scheer > XS4ALL Systeembeheer > > -- > 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. > >-- Nigel Kersten - Puppet Labs - http://www.puppetlabs.com -- 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.
Alan Barrett
2010-Nov-03 15:56 UTC
Re: [Puppet Users] Does puppetmaster knows its own configuration parameters?
On Wed, 03 Nov 2010, Robert Scheer wrote:> > In version 0.25, you can say > > > > $server = inline_template("<%= Puppet.settings[:server] %>"). > > Thanks! Puppet.settings[:server] is exactly what I was looking for. I had > tried variations of server, puppet.server and search(), but failed. Do you > know where in the documentation or in the wiki could I have found this?No, sorry. I think I picked it up from reading the source code. --apb (Alan Barrett) -- 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.