Thanks for your reply. I'll try it right now. Regards.
On Wed, Oct 3, 2012 at 11:18 AM, jcbollinger <john.bollin...@stjude.org> wrote: > > > On Tuesday, October 2, 2012 1:03:23 PM UTC-5, Darvin Denmian wrote: >> >> Hi, >> >> Is it possible to set the value of a variable from the content of >> a text file? >> > > If the target file is on the master, then you can load its entire contents > into a variable via the file() function that David suggested: > > $myvar = file('/path/to/file') > > If needed, you can then use other Puppet functions to parse out the value > you want. > > Alternatively, you can always write a custom function to parse any file > format you want. If the target file is one that you intend to create and > maintain for this purpose, however, then I would recommend using Hiera > instead. It's a little more involved to set up (unless you're on Puppet 3, > where it's built in), but it's the de facto standard for accessing external > data even on Puppet 2. > > On the other hand, if your file resides on the node being configured, then > what you're looking for is a custom fact. They are pretty easy to write and > distribute: http://docs.puppetlabs.com/guides/custom_facts.html. > > > John > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/I6MysO4VpEsJ. > > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.