Ask Your Question

Razor Server set static IP

asked 2016-03-01 07:34:19 -0600

tatroc gravatar image

What is the standard way to set a static IP on a node after it has been deployed with Razor. I am doing a POC with Razor, I was able to deploy a CentOS server. However, I'm unsure of how to set the static IP. It would be preferable if I could set it during the Razor install. Or configure it after install using the puppet agent.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-10-28 14:00:54 -0600

FatTony gravatar image

updated 2017-10-28 14:01:25 -0600


Simply adding the --ip value to the kernel_args.erb file did not work. I needed to add it to the kickstart template as the follows:

network --bootproto=static --ip <%= node.metadata['ip'] || node.ip %> --device=eth0

Do you know how I can add it without specifying the eth0 device, e.g in cases I don't know the device name from the start?

edit flag offensive delete link more

answered 2016-03-03 15:24:18 -0600

smcclellan gravatar image


I'd recommend using hooks for this. The flow would be that a node binds to a policy, which triggers a hook script to run. That hook script determines which static IP a node should use. The script returns that value as metadata, which gets applied to the node. Later, when the node requests its install script, this metadata can be used to change how the install scripts are rendered for the node, in this case setting the static IP.

Here's what would be required:

  • Write a hook that will run on the node-bound-to-policy event. This hook should operate similar to the hostname hook, so that can be used as a model if you choose to write yours in Ruby. The job of this script, which can be written in any executable language, is to update the node's ip metadata to the desired value.
  • Modify the kernel_args.erb in your task to set the static IP of the node to the ip value of the node's metadata, e.g.: --ip=<%= node.metadata['ip'] %>

The hook script can be as complicated or simple as you like. You could have a block of available addresses and use a counter to select an available value, or query an external system for the value, or any other number of methods.

Let me know if you need any further help!


edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools



Asked: 2016-03-01 07:34:19 -0600

Seen: 386 times

Last updated: Oct 28 '17