Is there a way to use ruby commands inside puppet manifest

131 views
Skip to first unread message

Malintha Adikari

unread,
Jun 24, 2014, 7:14:00 AM6/24/14
to puppet...@googlegroups.com
Hi,

I have faced a blocker in my manifests. I am using external facters and I use those external facters inside my templates ( after parsing it to xml ). I want to do the same thing in my manifets as I  want to get some variable details from those external facters in my manifests. I can get external facters in manifests. But the problem is to get the xml format. If I could use ruby inside my manifests I can parse those facters to xml and use. Can I use ruby inside manifests or is there any other alternative ?

Regards,
Malintha Adikari

Felix Frank

unread,
Jun 24, 2014, 8:11:09 AM6/24/14
to puppet...@googlegroups.com
Hi again,

http://docs.puppetlabs.com/guides/custom_functions.html

No offense, but as you appear to be struggling with the basics and
working towards very specific goals, it would appear that you could
benefit a lot from training - http://puppetlabs.com/services/training

(No, I'm not affiliated with PL, I just like those guys - they do a
great job :-)

Cheers,
Felix

jcbollinger

unread,
Jun 25, 2014, 9:57:26 AM6/25/14
to puppet...@googlegroups.com


On Tuesday, June 24, 2014 6:14:00 AM UTC-5, Malintha Adikari wrote:
Hi,

I have faced a blocker in my manifests. I am using external facters and I use those external facters inside my templates ( after parsing it to xml ). I want to do the same thing in my manifets as I  want to get some variable details from those external facters in my manifests. I can get external facters in manifests. But the problem is to get the xml format. If I could use ruby inside my manifests I can parse those facters to xml and use. Can I use ruby inside manifests or is there any other alternative ?



As Felix implied, you can write a custom function.  You can also use the template() or inline_template() function for this purpose -- the result is just a string, so it can be assigned to a puppet variable or otherwise processed by Puppet manifest code; it does not need to be assigned directly to a resource parameter.

And, yes, you might find formal training to be very useful.


John

Reply all
Reply to author
Forward
0 new messages