Method: Pec::Handler::UserData::Nic::Rhel.ifcfg_config
- Defined in:
- lib/pec/handler/user_data/nic/rhel.rb
.ifcfg_config(network, port) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/pec/handler/user_data/nic/rhel.rb', line 6 def ifcfg_config(network, port) base = { "name" => port.name, "device" => port.name, "type" => 'Ethernet', "onboot" => 'yes', "hwaddr" => port.mac_address } base.merge!( { "netmask" => IP.new(network[CONFIG]['ip_address']).netmask.to_s, "ipaddr" => port.fixed_ips.first['ip_address'] } ) if network[CONFIG]['bootproto'] == "static" safe_merge(base, network).map {|k,v| "#{k.upcase}=#{v}\n"}.join end |