mark.allison@thebbgroup.org
2013-Mar-18 14:19 UTC
[Puppet Users] compute a value at catalog apply-time and use in resources
Hi I''m using vagrant/puppet to create development environments for our team. Part of the set-up is creating a reverse ssh tunnel between the vagrant box and a central server. I''d like to be able to automatically allocate that port number when ''provision'' is run and use it in a couple of resource definitions. Having Googled around I''ve not found an idiomatic way to do this. I tried using a custom fact which exec''d a script to find a free port. The fact worked fine when invoked via facter but hung when run via puppet. For now I''ve settled on using an exec resource to post-process a file and set the port number. Other resources can access the port number by grepping that modified file. None of that feels correct. My best guess is that a custom fact is the way to go but I''d appreciate some pointers. Thanks! Mark -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
mark.allison@thebbgroup.org
2013-Mar-18 16:34 UTC
[Puppet Users] Re: compute a value at catalog apply-time and use in resources
A custom fact was the way to go. My fact was hanging because I hadn''t supplied ''-n'' to the ssh invocation. Apologies for the noise. Mark On Monday, March 18, 2013 2:19:14 PM UTC, mark.a...@thebbgroup.org wrote:> > Hi > > I''m using vagrant/puppet to create development environments for our team. > Part of the set-up is creating a reverse ssh tunnel between the vagrant box > and a central server. I''d like to be able to automatically allocate that > port number when ''provision'' is run and use it in a couple of resource > definitions. > > Having Googled around I''ve not found an idiomatic way to do this. I tried > using a custom fact which exec''d a script to find a free port. The fact > worked fine when invoked via facter but hung when run via puppet. > > For now I''ve settled on using an exec resource to post-process a file and > set the port number. Other resources can access the port number by grepping > that modified file. None of that feels correct. > > My best guess is that a custom fact is the way to go but I''d appreciate > some pointers. > > Thanks! > Mark > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.