define variables in puppet manifests from text file

279 views
Skip to first unread message

Ankita kumari

unread,
Jun 23, 2014, 7:04:30 AM6/23/14
to puppet...@googlegroups.com
Hi,

I want to pass the variables in puppet manifests from text file. The text file contains a list of values in different lines. I want to pass these values to the variables defined in the manifest.


Thanks & regards,
Ankita

Henrik Lindberg

unread,
Jun 23, 2014, 12:51:02 PM6/23/14
to puppet...@googlegroups.com
On 2014-23-06 9:04, Ankita kumari wrote:
> Hi,
>
> I want to pass the variables in puppet manifests from text file. The
> text file contains a list of values in different lines. I want to pass
> these values to the variables defined in the manifest.
>
.pp files are text files ;-)
In older puppet versions you can simply import that .pp file, in newer
versions you can use the directory based manifest support and simply add
the .pp file in the directory from which all "site" manifests are loaded.

Also take a look at hiera.

Regards
- henrik


>
> Thanks & regards,
> Ankita
>
> --
> 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...@googlegroups.com
> <mailto:puppet-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/bcac09d3-e199-4127-b93a-6500a2b3f1dc%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/bcac09d3-e199-4127-b93a-6500a2b3f1dc%40googlegroups..com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

Ankita kumari

unread,
Jun 24, 2014, 12:30:42 PM6/24/14
to puppet...@googlegroups.com


I want to put the content of .txt file in the manifest as variable

Felix Frank

unread,
Jun 24, 2014, 12:37:14 PM6/24/14
to puppet...@googlegroups.com
For files that are located on the puppetmaster (and readable to the
master process), you can use a function.

http://docs.puppetlabs.com/references/stable/function.html#file

$my_variable = file("/data/stuff/cool_file")

HTH,
Felix
Reply all
Reply to author
Forward
0 new messages