Ask Your Question

Modify puppet razor node name (not hostname) to a unique node name after registration instead of node names like node1,node2,node3

asked 2016-10-25 11:30:18 -0500

worldian gravatar image

I am trying to use puppet razor to deploy about 1000 servers, and i realize that puppet razor gives node names like node1,node2,node3 after a node is registered.

Is there any way to set user-specific node names to these servers, either before registration or after registration?

The reason being : After provisioning all these 1000 servers - and if one of those servers needed to be re-provisioned later in future - it would be easier to install using its hostname ( OS hostname).

Right now - when i run - 'razor nodes'. All i see is a list of node names such as node1,node2,node3 and mac-addresses. If i have to re-install one of those 1000 servers - It would be a round about way to find out the mac-address of that machine and find the nodename of that mac-address to re-install that node.

I am able to edit the node metadata - hostname successfully, but i would like to be able to edit the node name to be the same as the node OS hostname.

Is there any easy way to do this? ( other than writing my own wrapper to link the mac-addresses with hostnames and node names in CMDB)

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2017-02-01 16:25:48 -0500

smcclellan gravatar image

Node names in Razor are considered an internal identifier. If you want to find a node, I would suggest hitting the nodes endpoint directly and exporting the JSON data that is returned. For a basic install, that'll be https://RAZORURLHERE:8151/api/collections/nodes (*)

(*) Caveat: Razor's endpoints should always be derived from what is returned by the /api entrypoint. At the time of this writing, the above URL is what is used.

edit flag offensive delete link more


I actually have a similar question, and have opt'd to do as suggested. However, provided the json payload linked below, I can't figure out how to access the node metadata.hostname (NOT the policy issued hostname).

reesek gravatar imagereesek ( 2017-02-03 14:41:10 -0500 )edit

In that payload it's near the bottom: "metadata"."hostname", which will evaluate to "ccamqp01". Edit: Extra detail in case it's needed — You'll want to parse the string returned as JSON so you can reference the properties as structured data rather than as a string. In Ruby that's `JSON.parse`.

smcclellan gravatar imagesmcclellan ( 2017-02-03 15:05:06 -0500 )edit

Thx. Overall, it would be more helpful to me if I could query the API for node specified metadata. To the point of the authors ?, I inherently know the fqdn of the host, NOT the internal identifier. Programmatically, I don't want to have to query each node to find what I'm looking for. Any ideas?

reesek gravatar imagereesek ( 2017-02-03 15:50:01 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-10-25 11:30:18 -0500

Seen: 151 times

Last updated: Feb 01