Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
$ grep 'node\[:network\]\[:interfaces\].' \#chef.log
10:15 < mkent_> node[:network][:interfaces][:eth1][:addresses]
22:24 <+Damm> msf, just pulling in the node[:network][:interfaces] attributes
20:44 < randybias> node[:network][:interfaces][:eth0][:addresses]
09:13 < sinBot> so fujin if I wanted to use that in an erb template, it'd be <%= @node[:network][:interfaces]["en1"]["addresses"].select{address}.flatten.to_str %> ?
12:27 < cwj> if i have an ipv4 ip address set on eth0, will it always be in @node[:network][:interfaces][:eth0][1] ?
02:19 < pluesch0r> however, i don't seem to be able to access @node[:network][:interfaces]... from inside the attributes file.
19:52 <@jtimberman> or node[:network][:interfaces][:eth0][:addresses][0]
20:09 < seryl> well, it's searchable. I'm trying the @node[:network][:interfaces][:eth0][:addresses][0] route, but getting blanks right now, playing around with it in chef solo
20:29 < kallistec> pp node[:network][:interfaces].current_attribute
11:15 < cwj> well if you already have the attributes from the node, you would access it through something like @node[:network][:interfaces][:eth0][:addresses]
13:11 < galstrom> also.. if i am looping through node[:network][:interfaces] i can access each interfaces sub hash with "[:eth0]" at the end
08:08 < shutterman> In a default installation, one client has an attribute node[:network][:interfaces][:eth1][:addresses][:][:family][:inet]. I want to extract that IP address and use in a recipe, instead of creating a script to get this information which is already available through Chef. I thought that somehow I could have a variables clause in the recipe as :myeth1address => node[:network][:interfaces][:eth1][:addresses]... but I can't find a way to extract t
08:10 < renchap> node[:network][:interfaces][:eth1][:addresses].each { |ip| puts ip } ?
08:17 < renchap> node[:network][:interfaces][:eth1][:addresses].find { |name, options| options[:family] == 'inet' }.each { |ip| ... }
08:20 < renchap> node[:network][:interfaces][:em1][:addresses].find_all { |name, options| options[:family] == 'inet' }.each { |ip,options| puts ip }
08:46 < shutterman> renchap: Got it working: :myeth1ipaddress => node[:network][:interfaces][:eth1][:addresses].keys.first -- Thanks a lot for your help pointing me the correct way of doing it.
19:20 < larrywright> node[:network][:interfaces][:eth1]
19:21 < kallistec> larrywright: I get chef > pp node[:network][:interfaces][:eth0][:addresses].keys
19:23 < larrywright> pp node[:network][:interfaces][:eth1][:addresses].keys.first
19:26 < kallistec> pp node[:network][:interfaces][:eth0][:addresses] {|addr, info| info["family"] == "inet"}.flatten.first
13:19 < ryanschwartz> hi all. can anyone tell me why @node[:network][:interfaces] lists IP addresses in numerical order, rather than alias order?
02:03 < asdf_> package "ipcalc" do action :install end template "/etc/network/interfaces" do source "interfaces.erb" variables({ :iface => node[:network][:default_interface], :ip => node[:ipaddress], :broadcast => node[:network][:interfaces][node[:network][:default_interface]][:addresses][node[:ipaddress]][:broadcast], :gateway => `ip route | grep default | cut -d' ' -f3`.strip, :netmask => node[:network][:interfaces][node[:n
16:05 <@kallistec> btm: node[:network][:interfaces][:en1][:addresses].select {|addr, addr_info| addr_info["family"] == "inet" }
15:09 <@kallistec> rcreasey: node[:network][:interfaces][:en1][:addresses].to_hash.find {|addr, addr_info| addr_info['family'] == 'inet'}.first
19:12 < benblack> node[:network][:interfaces][:eth0][:addresses]
19:21 < benblack> but, again, do you see it with knife node show? is it not available with node[:network][:interfaces][:eth0]?
19:31 < larrywright> the best I can do is node[:network][:interfaces][:eth1]
19:32 < larrywright> node[:network][:interfaces][:eth1][:addresses]
19:32 < larrywright> chef:recipe > node[:network][:interfaces][:eth1][:addresses].keys
19:33 < benblack> node[:network][:interfaces][:en1][:addresses].map {|i| i.first if i.last["family"].eql?("inet") }.compact.first
16:07 < rcreasey> specifically: node[:network][:interfaces][:lo:0][:addresses].first
16:13 <@kallistec> rcreasey: node[:network][:interfaces][:lo0][:addresses].find {|addr, addr_info| addr_info[:family] == "inet"}.first
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment