Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

network_interfaces_v2 (13) Versions 2.8.0

Providers for configuring network on Ubuntu, RHEL, and Windows

Policyfile
Berkshelf
Knife
cookbook 'network_interfaces_v2', '= 2.8.0', :supermarket
cookbook 'network_interfaces_v2', '= 2.8.0'
knife supermarket install network_interfaces_v2
knife supermarket download network_interfaces_v2
README
Dependencies
Changelog
Quality -%

Cookbook network_interfaces_v2

Build Status

A cookbook containing providers for defining network interfaces.

Supported Platforms

  • RHEL 6.x
  • RHEL 7.x
  • Ubuntu >= 12.x
  • Windows 2012R2

Semi-supported

These operating systems are not currently being tested on but have been confirmed by other users to be working.

  • RHEL 7.x
  • Windows 2008R2
    • Works if PowerShell/WMF 4.0 is present, which can be installed via network_interfaces_v2::powershell_installer recipe

Usage

Add depends 'network_interfaces_v2' to your cookbook metadata.rb file. This
will give you access to the providers documented below.

Recipes

default

Does nothing and does not need to be included.

powershell_installer

Installs WMF 4.0 for Windows 2008 R2 which is a prereq for this cookbook's providers to work on Windows 2008 R2.

network_interface

Provider for managing network interfaces.

Attributes

  • device (REQUIRED) - Device name
  • onboot (default: true) - Wether or not to online device on boot
  • bootproto (default: 'dhcp') - Device protocol
  • bond_mode - Bonding mode
  • address - IP address
  • netmask - Netmask
  • gateway - Gateway IP address
  • broadcast - Broadcast address
  • mtu - MTU
  • hw_address - For linux it sets MAC address of device, for windows it selects device matching MAC to configure
  • vlan
    • debian - VLAN device interface
    • RHEL - true/false if device defined is a VLAN interface
    • Win - Integer VlanID to tag to defined device
  • post_up - Post up command to run after modifying the interface
  • reload (default: true) - Wether or not to reload the device on config changes
  • reload_type (default: :immediately) - When to reload device on config changes
  • cookbook (default: 'network_interfaces_v2') - Cookbook to look for template files in
  • source (default: 'ifcfg.erb') - Template file to use for interface config

Debian Only Attributes

  • ipv6 (true/false) - Wether this is an inet or inet6 network interface.
  • bridge_stp (true/false) - Wether to enable/disable bridge STP. Applies to debian only.
  • bridge_ports - Array of interfaces to add to defined bridge
  • metric -
  • bond_slaves - Array of interfaces to add to defined bond
  • pre_up (default: 'sleep 2')- Pre up command
  • up - Up command
  • post_up - Post up command
  • pre_down - Pre down command
  • down - Down command
  • post_down - Post down command
  • custom - Hash of extra attributes to put in device config

RHEL Only Attributes

  • prefix - Netmask length (e.g. 24 for 255.255.255.0)
  • dns - Array of DNS servers
  • type - Protocol Type. Applies to RHEL only.
  • bond_master - Device that is the bond master for defined device. Applies to RHEL only.
  • nm_controlled (default: false)- If device should be controlled by network manager.
  • type (default: 'Ethernet') -
  • ipv6init - true/false
  • nozeroconf - true/false
  • userctl - true/false
  • peerdns - true/false
  • bridge_device - Bridge to add defined interface to
  • devicetype - Set the type of device (e.g. 'ovs')
  • ovs_bridge - OVS Bridge to bind ovs port to (primarily used when type is set as 'OVSPort')
  • dns_domain - DNS domain
  • zone - FirewallD zone
  • arpcheck - Whether to arping before bringing up an ethernet device to check for an IP conflict (default: true)
  • hotplug - Activate devices on hotplug (default: true)

Windows Only Attributes

  • hw_address - Can be used to define what device to manage
  • index - Can be used to define what device to manage
  • dns - Array of DNS servers
  • dns_domain - DNS domain
  • ddns - true/false dynamic dns registration
  • netbios - Enable/Disable netbios on the interface. Valid values: true, false, 'dhcp'

Providers

Long name Short name
Chef::Provider::NetworkInterface::Rhel rhel_network_interface
Chef::Provider::NetworkInterface::Debian debian_network_interface
Chef::Provider::NetworkInterface::Win win_network_interface

Examples

Basic example:
ruby
network_interface 'eth1' do
bootproto 'static'
address '10.12.10.11'
netmask '255.255.255.0'
gateway '10.12.10.1'
end

Two interface DHCP bond0 on rhel family
```ruby
network_interface 'eth1' do
bootproto 'none'
bond_master 'bond0'
end

network_interface 'eth2' do
bootproto 'none'
bond_master 'bond0'
end

network_interface 'bond0' do
bond_mode 'mode=1 miimon=100'
end
```

Two interface DHCP bond0 on debian family
```ruby
network_interface 'bond0' do
bond_slaves ['eth1', 'eth2']
bond_mode '0'
end

network_interface 'eth1' do
bootproto 'manual'
bond_master 'bond0'
end

network_interface 'eth2' do
bootproto 'manual'
bond_master 'bond0'
end
```

On windows manage device with MAC '00-25-B5-5B-00-25', name it 'eth2',
make it DHCP (default bootproto) and VLAN tagged to VLAN 12
ruby
network_interface 'eth2' do
hw_address '00-25-B5-5B-00-25'
vlan 12
end

Testing

Requires ChefDK 0.12.0.

rubocop
foodcritic -f any -X spec .
rspec --color --format progress
kitchen test

License and Authors

Author:: Jacob McCann (jacob.mccann2@target.com)

Based on work from https://github.com/redguide/network_interfaces

Copyright:: 2015, Target Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

2.8.0

  • Add hw_address support for debian

2.7.0

  • Add ipv6 support for debian

2.6.0

  • Add management of debian DNS
  • Add management of RHEL firewalld zones

2.5.1

  • Fix RHEL configs from on/off to yes/no

2.5.0

  • Add powershell installer for Windows 2008 R2 to allow cookbook to work

2.4.1

  • bug: Fix win_interface to be able to manage interfae via index
  • bug: Enable static on win_interface when DHCP with matching ip/subnet (#13)

2.4.0

  • Add dns_domain attribute to network_interface for RHEL

2.3.0

  • Add ovs_bridge attribtue to network_interface for RHEL

2.2.0

  • Add dns attribute to network_interface for RHEL
  • Add devicetype attribute to network_interface for RHEL
  • Add prefix attribute to network_interface for RHEL

2.1.2

  • Add supported platforms to metadata.rb
  • Update gem source for integration testing to https from http

2.1.1

  • Update how to determine when to specify provides in providers

2.1.0

  • Remove dependency on ruby-wmi gem

2.0.1

  • Fix handling DNS for windows VLAN devices

2.0.0

  • Fix providers not triggering notifications
  • No longer manage removal of 'extra' network config files in debian
  • Add ability to enable/disable NetBIOS on windows interfaces

1.1.0

  • Add running post scripts on interface config to all platforms
  • On windows release DHCP address when configuring static from DHCP
  • Update logic for configuring static address
    • Update if address or netmask are missing or incorrect
    • Add IP to 'front' of array of addresses ... keep any extra addresses that may have been configured outside of Chef
    • I've heard this can happen from things like MSFT products/services being added to a system ... like clustering

1.0.0

Initial release of network_interfaces_v2

No quality metric results found