Our puppetmaster runs on a host with multiple interfaces connected to various private networks, with different hostnames for each IP. I''m trying to use $servername in modules to copy files over a private network, but this is always set to the public hostname of the server. That route is blocked by a firewall. Is there a way to use the server variable in puppet.conf in manifests?
James Turnbull
2007-Oct-04 21:35 UTC
Re: use client''s server variable instead of $servername?
Gene Hand wrote:> Our puppetmaster runs on a host with multiple interfaces connected to > various private networks, with different hostnames for each IP. I''m > trying to use $servername in modules to copy files over a private > network, but this is always set to the public hostname of the server. > That route is blocked by a firewall. Is there a way to use the server > variable in puppet.conf in manifests?The servername fact is created from Facter''s fqdn fact. I''d create a variable for each hostname/IP in your manifest and use that. Regards James Turnbull -- James Turnbull <james@lovedthanlost.net> --- Author of Pro Nagios 2.0 (http://www.amazon.com/gp/product/1590596099/) Hardening Linux (http://www.amazon.com/gp/product/1590594444/) --- PGP Key (http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x0C42DF40) _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
James Turnbull wrote:> Gene Hand wrote: > >> Our puppetmaster runs on a host with multiple interfaces connected to >> various private networks, with different hostnames for each IP. I''m >> trying to use $servername in modules to copy files over a private >> network, but this is always set to the public hostname of the server. >> That route is blocked by a firewall. Is there a way to use the server >> variable in puppet.conf in manifests? >> > > The servername fact is created from Facter''s fqdn fact. I''d create a > variable for each hostname/IP in your manifest and use that. > > Regards > > James TurnbullHmm, I''m not sure I follow.. perhaps if we concoct an example.. I have a base module that is applied to all servers with something like this: file { "/etc/hosts": source => "puppet://$servername/base/hosts", } Some systems contact the puppetmaster as "puppet.domain.com" over the public interface while others contact it as "puppetp" (a 10.0.0.x address). In both cases, $servername gets set to "puppet.domain.com" and the file transfers for machines on the private network fail. How would I dynamically create the variables so that file transfers go to the same place as the original connection? I don''t see any facter variables related to the puppetmaster. Thanks for your help. _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
James Turnbull
2007-Oct-04 23:20 UTC
Re: use client''s server variable instead of $servername?
Gene Hand wrote:> Hmm, I''m not sure I follow.. perhaps if we concoct an example.. I have a > base module that is applied to all servers with something like this: > > file { "/etc/hosts": > source => "puppet://$servername/base/hosts", > } > > Some systems contact the puppetmaster as "puppet.domain.com" over the > public interface while others contact it as "puppetp" (a 10.0.0.x > address). In both cases, $servername gets set to "puppet.domain.com" > and the file transfers for machines on the private network fail. How > would I dynamically create the variables so that file transfers go to > the same place as the original connection? I don''t see any facter > variables related to the puppetmaster.Oh okay! Now I see what you''re getting at. As I mentioned before $servername is set on the master as the same value of the fqdn on the master - so you''re always going to get puppet.domain.com. But I think my original solution still works - an example. node ''internal'' { $server = "puppetp" include file_transfer } node ''external'' { $server = "puppet.domain.com" include file_transfer } class file_transfer { file { "/etc/hosts": source => "puppet://$server/base/hosts". } } The $server variable will be replaced with the appropriate value from each node. It''s a little messy - you could do it differently with inheritance - create a template node called internal and another called external - set the variables in those template nodes and have each node inherit the right template node. Regards James Turnbull -- James Turnbull <james@lovedthanlost.net> --- Author of Pro Nagios 2.0 (http://www.amazon.com/gp/product/1590596099/) Hardening Linux (http://www.amazon.com/gp/product/1590594444/) --- PGP Key (http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x0C42DF40) _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
David Lutterkort
2007-Oct-05 16:47 UTC
Re: use client''s server variable instead of $servername?
On Thu, 2007-10-04 at 09:22 -0700, Gene Hand wrote:> Our puppetmaster runs on a host with multiple interfaces connected to > various private networks, with different hostnames for each IP. I''m > trying to use $servername in modules to copy files over a private > network, but this is always set to the public hostname of the server. > That route is blocked by a firewall. Is there a way to use the server > variable in puppet.conf in manifests?Have you tried leaving the server part of the puppet: URL completely empty ? puppetd will fill in the name of the puppetmaster (where it got the config from) in that case, i.e. try ''puppet:///foo/bar.txt'' instead of "puppet://$servername/foo/bar.txt" David
David Lutterkort wrote:> On Thu, 2007-10-04 at 09:22 -0700, Gene Hand wrote: > >> Our puppetmaster runs on a host with multiple interfaces connected to >> various private networks, with different hostnames for each IP. I''m >> trying to use $servername in modules to copy files over a private >> network, but this is always set to the public hostname of the server. >> That route is blocked by a firewall. Is there a way to use the server >> variable in puppet.conf in manifests? >> > > Have you tried leaving the server part of the puppet: URL completely > empty ? puppetd will fill in the name of the puppetmaster (where it got > the config from) in that case, i.e. try ''puppet:///foo/bar.txt'' instead > of "puppet://$servername/foo/bar.txt" > > David > >Nice.. that did the trick. Is there a way to do something similar for the default filebucket setting? I had: filebucket { main: server => $servername } File { backup => main } This was also causing it to hang, so I''ve commented it for now and using local clientbuckets. Many thanks.