Ask Your Question

Setting a static IP on a node?

asked 2015-02-17 15:41:17 -0500

Rob D. gravatar image

I'm learning Puppet, so excuse my newb-ness. I'm trying to do something pretty simple: set a static IP on a particular node. I can see there are a number of different network tools that are widely used, such as adrien/network, but I can't figure out where to put the network_config; does it go in the node definition? Do I need to import the module or is pulling the module from Puppet Forge enough?

Better yet, is there an example out there someone can point to which describes how to set a static IP?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-02-18 12:05:54 -0500

GregLarkin gravatar image

I recommend installing a Puppet-approved or Puppet-supported module on your Puppet master to manage network settings on your agent. I searched for one on the Forge and came up with: This is a Puppet-approved module.

To install it, follow the instructions at the top of the page and run the command on your Puppet master:

puppet module install example42-network

Next, you should start developing modules and classes to configure your nodes to your needs. As Hugh mentioned, the roles/profiles pattern is a common way to do that. Also, I would recommend reading Gary Larizza's blog, and especially the workflow series, starting with Part 1. This will give you all of the information you need to build your Puppet code and leverage Puppet Forge modules.

Next, classify your node with your newly-created class, whether it's a full-fledged role or something that simply declares a resource from the example42/network module like so:

network::interface { 'eth0':
  ipaddress => '',
  netmask   => '',

Much more information can be found in the module's usage documentation.

Before you jump into all of that, though, you might consider downloading the Puppet Learning VM and going through some self-paced exercises to get the basics about Puppet. There are also a wealth of other Puppet learning resources at the main learning portal.

edit flag offensive delete link more

answered 2015-02-18 06:26:02 -0500

hesco gravatar image

updated 2015-02-18 06:28:46 -0500

Rob D:

You might benefit from reading up a bit about the role-profile pattern.

This link looks relevant:

In general, I do this like so:


node '' { include server_init::puppetmaster }


class server_init::puppetmaster {
  include iptables
  include puppet
  include mosh
  include postfix
  include postfix::relay_host
  include postfix::iptables
  include file_tree
  include user
  include user::root
  include user::root_key_pair
  include user::applications::deploy
  include user::applications::backups
  include git
  include utilities
  include utilities::network_tools

Not being familiar with adrien/network, you might be able to include network directly in this role definition, or perhaps you would benefit from wrapping it in your own ourclusternetwork class and including that instead, so you can wrap the generic module up with the parameters and other network configuration required for this specific installation.

Good luck, -- Hugh

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

1 follower


Asked: 2015-02-17 15:41:17 -0500

Seen: 1,555 times

Last updated: Feb 18 '15