Ask Your Question
0

hiera host-network-information

asked 2016-03-11 09:55:25 -0500

eberthiaume gravatar image

updated 2016-03-14 04:00:51 -0500

Hello all!

I trying to figure out how to put my host network information under hiera (using puppet4 opensource with no enc)

Maybe I got this all wrong but this what I was thinking:

Base.pp

profiles::base
   include profiles::network

Network.pp # contains my logic to check if it's static or bonding network interface. Calls razoredge network module to actually do the work.

  class profiles::network {
     If hiera(profiles::network::network_info::type) == bonding {    #based on fqdn hiera lookup
       network::bond::static { ‘bond0’:
         ensure        => ‘up’,
         ipaddress  =>  “profiles::network::network_info::ipadress”
       else
      network::if::static
         ensure         => ‘up’
         ipadress      => “profiles::network::network_info::ipadress”
  }

host1.toto.com.yaml #host network information based on fqdn hiera declaration

profiles::network::network_info
  type: bonding
  ipadress: 10.10.10.10
  gateway: 10.10.10.1
  routes:
-   10.10.10.2
-   10.10.10.3

I know my code is all wrong but anybody using hiera for host-network-information? Or if it's really bad practice to do so.

Thanks!

Eric

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2016-03-14 04:19:42 -0500

eberthiaume gravatar image

updated 2016-03-15 07:19:59 -0500

First sorry about my code with capital letters.... gesshhh that is what you get when using outlook to just lay out a forum post...

Thanks for your reponse... i do know the "cutting branch beneath you" scenario and yeah looking at it doesn't make scene. Thing is the compagny i'm at doesn't have a real provising workflow at the moment so i'm working with what i have. Image is kickstarted with a single ip (same one reserved in our ipam) and after that we assign the right network information via Puppet. We do have console access if something goes wrong.

It's not the best scenario i agree but this is the one i'm working with...

We also have to manage bond interface and for that i think Puppet does a great job. This is why i had put it in my initial question.

So my original question remains ... do people use hiera to manage network interface information or not at all? Or how do people use razorsedge module in a large production environment?

last tought..... maybe ... kickstart image ... git clone a puppet master-less setup from our git that would contain a small hiera host config that would be applied after?

EDIT Also editing my comment so i can include code.

Thanks for you answer! This is the syntax i was using but i got to razorsedge page and saw that the module was updated... and now it show hiera exemples!!! Now my profile looks like this:

base.pp

include network::hiera

host.yaml

    ---
network::bond_static:
  bond0:
    ensure: up
    ipaddress: 10.10.10.10
    netmask: 255.255.255.0
    mtu: 9000
    gateway: 10.10.10.254
    bonding_opts: 'mode=4 miimon=100 lacp_rate=fast ad_select=bandwidth xmit_hash_policy=2'
network::route:
  bond0:
    ipaddress: ['10.10.10.0']
    netmask: ['255.255.255.0']
    gateway: ['10.10.10.254']

That works great..... still working on a cleaner deploy solution for my architecture but for now this is working good.

edit flag offensive delete link more

Comments

Based on number of downloads on forge, the module is used [quite frequently](https://forge.puppetlabs.com/razorsedge/network). I'll update my answer, as these comment don't support code formatting.

deric gravatar imagederic ( 2016-03-15 04:45:45 -0500 )edit
0

answered 2016-03-13 06:51:47 -0500

deric gravatar image

updated 2016-03-15 04:51:32 -0500

Puppet agent typically fetches information over network. You should be very careful not to mess up with primary interface (or the interface which is used for connection to Puppet master). If you want to manage VLANs, VPN interfaces etc. it should be ok.

There are other scenarios (master-less setup) - e.g. when you're provisioning new machine (connected via console or chroot), where it make sense to reconfigure all interfaces and you're not "cutting branch beneath you".

For the master-less setup you would just install puppet, required modules, e.g.:

puppet module install puppetlabs-stdlib
puppet module install razorsedge-network
puppet apply --debug /tmp/my_conf.pp

Where the /tmp/my_conf.pp would contain something like:

network::bond::slave { 'eth1':
  macaddress   => 'aa:bb:..',
  ethtool_opts => 'autoneg off speed 1000 duplex full',
  master       => 'bond0',
}
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

Stats

Asked: 2016-03-11 09:55:25 -0500

Seen: 196 times

Last updated: Mar 15 '16