[chef] Re: How do I configure /etc/network/interfaces using chef?


Chronological Thread 
  • From: Sean OMeara < >
  • To:
  • Subject: [chef] Re: How do I configure /etc/network/interfaces using chef?
  • Date: Thu, 20 Mar 2014 09:42:49 -0400

er, accidentally sent that email before I was done writing it.


template '/etc/network/interfaces' do
  action :create
  source 'interfaces.erb'
  variables(
    eth0_ip => '1.2.3.4',
    eth1_ip => '5.6.7.8',
    eth2_ip => '9.10.11.12'
  )
end

Then, in the interfaces.erb, dig it out with ERB templating:

Hello eth0's ip is <%= @eth0_ip %>
Hello eth1's ip is <%= @eth1_ip %>
Hello eth2's ip is <%= @eth2_ip %>

Iterate this way until you're done.


Consuming a random cookbook you found on the community site like that may or may not work for you. That's going to require knowledge of Chef, the cookbook, AND ubuntu network configuration. 

If you have all three, great. If not, you may want to start more simply.

-s


On Thu, Mar 20, 2014 at 9:38 AM, Sean OMeara < " target="_blank"> > wrote:
The best and easiest place to start is "how do you configure them without Chef?"

You manipulate files under /etc.

With Chef, you'd start by identifying those files, and putting them under Chef management.

# In a recipe
template '/etc/network/interfaces' do
  action :create
  source 'interfaces.erb'
end

# copy yourserver:/etc/network/interfaces into your cookbook under templates/default/interfaces.erb

From, there you can start rendering data into this templates.

template '/etc/network/interfaces' do
  action :create
  source 'interfaces.erb'
  variables(

  )
end





On Wed, Mar 19, 2014 at 11:10 AM, Maciek Misztal < " target="_blank"> > wrote:
I'm looking for a way to configure N (N=3) ubuntu nodes with 2 network interfaces each - since I'm a complete newb, what is the proper way to do it?

Regards,
Maciej





Archive powered by MHonArc 2.6.16.

§