Display the contents of a yaml file

25 views
Skip to first unread message

Sergiu Cornea

unread,
Sep 3, 2015, 9:42:20 AM9/3/15
to Puppet Developers
Good morning guys,

I am not sure if I am asking the right question, however, I am looking for a Puppet / Foreman Web API that when called with a node name it will display the contents of that YAML file? The reason why I am asking is that I want a particular node YAML file to be displayed in a WebUI.

Does anyone knows how to do this? 

Thank you,

Regards,
Sergiu

This message and its attachments are private and confidential. If you have received this message in error, please notify the sender and remove it and its attachments from your system.

The University of Westminster is a charity and a company limited by guarantee. Registration number: 977818 England. Registered Office: 309 Regent Street, London W1B 2UW.

Eric Sorenson

unread,
Sep 3, 2015, 8:25:24 PM9/3/15
to puppe...@googlegroups.com
Hi Sergiu - Which yaml file? Do you mean the output of the node classifier? Or the file corresponding to $vardir/yaml/node/$hostname.yaml ?


If it's the first, it will depend on the Foreman ENC, but I believe it'd be a call to http://<yourforemanhost>/api/host/<nodename>  

If it's the second, you can use the /node endpoint: http://docs.puppetlabs.com/puppet/latest/reference/http_api/http_node.html

Hope this helps
--eric0


--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/e9fd5319-7761-4a50-84e2-ac675b0f0b25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eric Sorenson - eric.s...@puppetlabs.com - freenode #puppet: eric0
puppet platform // coffee // techno // bicycles

Dominic Cleal

unread,
Sep 4, 2015, 3:31:05 AM9/4/15
to puppe...@googlegroups.com
On 04/09/15 01:25, Eric Sorenson wrote:
> Hi Sergiu - Which yaml file? Do you mean the output of the node
> classifier? Or the file corresponding to $vardir/yaml/node/$hostname.yaml ?
>
>
> If it's the first, it will depend on the Foreman ENC, but I believe it'd
> be a call to http://<yourforemanhost>/api/host/<nodename>

If you're using Foreman's web UI then view the host, then click the YAML
button on the left.

The ENC script (node.rb) typically fetches
https://foreman.example.com/node/node.example.com?format=yml. This is
outside of the regular API.

There's not an way to retrieve the rendered YAML in the regular
authenticated API, only the above one intended specifically for the ENC
script.

The URL Eric suggested will give you lots of useful info about the host,
but in JSON rather than Puppet's YAML ENC format.

--
Dominic Cleal
Red Hat Engineering

John Bollinger

unread,
Sep 4, 2015, 3:26:44 PM9/4/15
to Puppet Developers

Please don't cross-post the same question to puppet-users and puppet-dev.  It is rarely appropriate.


John

Reply all
Reply to author
Forward
0 new messages