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

RSS

windows_network (5) Versions 0.3.0

Configures windows network interfaces

Berkshelf/Librarian
Policyfile
Knife
cookbook 'windows_network', '~> 0.3.0'
cookbook 'windows_network', '~> 0.3.0', :supermarket
knife cookbook site install windows_network
knife cookbook site download windows_network
README
Dependencies
Changelog
Quality

windows_network chef Cookbook

This cookbook will configure the network interfaces on Windows

It looks into a databag for IP information and sets it if it's not set as specified. It supports two different formats to store the IP configuration, to support logical and the 'udev' (a proprietary) format.

Requirements

This cookbook needs a data bag called 'servers' with an item named as your hostname. It also uses win_domain for fallback information.

Datatype 1 (default)

data bag [servers][hostname]
{
  "id": "mycomputername",
  "interfaces": [
    {
      "name":     "Local network",
      "mac":      "00:AC:21:BC:F0:E0", 
      "address":  "10.1.0.123",
      "netmask":  "255.255.255.0",
      "gateway":  "10.1.0.1",
      "dns-nameservers": "10.1.0.231,10.111.0.231",
      "dns-search": "mydomain.local"
    }
  ]
}

or for more than one interface: (here with multipe ip's)

{
  "id": "mycomputername",
  "interfaces": [
    {
      "name":     "Local network",
      "mac":      "00:AC:21:BC:F0:E1",  
      "address":  "dhcp"
    },
    {
      "name":     "Local network",
      "mac":      "00:AC:21:BC:F0:E0", 
      "address":  "10.1.0.123,10.1.0.124",
      "netmask":  "255.255.255.0,255.255.255.0",
      "gateway":  "10.1.0.1",
      "dns-nameservers": "10.1.0.231,10.111.0.231",
      "dns-search": "mydomain.local"
    }
  ]
}

Datatype 2 (aka udev)

data bag [servers][hostname]

Note that MAC addresses need to be in lowercase

{
  "id": "mycomputername",
  "def_gw": "192.168.1.195",
  "net": {
    "eth4": "00:20:56:9a:63:a1",
    "eth0": "00:20:56:9a:13:ee",
    "eth2": "00:20:56:9a:3b:b9",
    "eth1": "00:20:56:9a:40:08"
  },
  "ip": {
    "eth4": "192.168.4.127",
    "eth0": "192.168.3.228",
    "eth2": "192.168.2.228",
    "eth1": "192.168.1.199"
  },
  "netmasks": {
    "eth4": "nil",
    "eth0": "255.255.255.192",
    "eth2": "255.255.255.192",
    "eth1": "255.255.255.192"
  },
  "broadcasts": {
    "eth4": "nil",
    "eth0": "192.168.3.255",
    "eth2": "192.168.2.255",
    "eth1": "192.168.1.255"
  },
  "networks": {
    "eth4": "nil",
    "eth0": "192.168.3.192",
    "eth2": "192.168.2.192",
    "eth1": "192.168.1.192"
  },
  "naming": {
    "build": "00:20:56:9a:63:a1",
    "admin": "00:20:56:9a:13:ee",
    "back": "00:20:56:9a:3b:b9",
    "front": "00:20:56:9a:40:08"
  },
  "dns": {
    "dns1": "192.168.99.121",
    "dns2": "192.168.98.97"
  }
}

Environment (optional)

{
  "name": "office",
  "override_attributes": {
    "win_domain": {
      "DNS1": "10.1.0.231",
      "DNS2": "10.1.0.231",
      "DomainDNSName": "mydomain.local"
    }
  }
}

Usage

1 Include cookbook in recipe: recipe/default.rb

include_recipe "windows_network"

Optionally override attributes

node.override['windows_network']['databag_name'] = "udev" 
node.override['windows_network']['datatype'] = 2 

2 Include version in metadata: metadata.rb

depends 'windows_network', '>= 0.1.0'

3 Add data bag servers <hostname> as described above section

4 (optional) Add Environment variables under win_domain

Notes

  • If there is only one NIC and only one config in the data bag, then this config will be used.
  • If there is only one NIC and only one config in the data bag, then the mac entry can be omitted.
  • You can specify "dhcp" as address and the NIC will be configure for DHCP.

Todo

  • Handle multiple IP addresses per interface
  • Handle routes per interface

Contributing

  1. Fork the repository on Github
  2. Create a named feature branch (i.e. add-new-recipe)
  3. Write you change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request

License and Authors

Authors:

Christoffer Järnåker, Proxmea BV

Christoffer Järnåker, Schuberg Philis, 2014

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

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

CHANGELOG for windows_network

This file is used to list changes made in each version of sbp_win_ip.

0.3.0

  • jrnker - Based on Pull req from rvanderbrugge; implements handling of multiple ip addresses per interface.

0.2.3

  • jrnker - Added Ohai relead if network settings changed during run. This means that the node's changed attributes will be reflected in the rest of the run.

0.2.2

  • jrnker - Listened to foodcritic. - Changed the way bestdns is evaluated. Previously it evaluated each DNS server from each source (databag/environment/local setting), but now it uses the best source. - Explored some more if-then scenarios where certain values can be nil and made sure that was handled without exception. - Fixed that datatype 2 could return an empty dns array if the dns entry didn't exist in the data bag. Now it returns nil. - Added Berksfile - If a subnet mask isn't valid then the IP address is also considered invalid. - Also checking default gateway so that it's set right

0.2.1

  • jrnker - Wrapping come code into execute statements - Reformatting readme.md - Fixed default netmask if not specified

0.2.0

  • jrnker - Handles multiple (2) datatype formats for the interfaces - Cleaned up code to satisfy foodcritic - Broke out code into several libraries - Fixed spelling error of the 'databag_name' attribute

0.1.1

  • jrnker - Implemented handling of IP storage in custom data bag name. Implemented handling of NIC storage in different format

0.1.0:

  • Initial release of windows_network

Check the Markdown Syntax Guide for help with Markdown.

The Github Flavored Markdown page describes the differences between markdown on github and standard markdown.

Collaborator Number Metric
            

0.3.0 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

0.3.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

0.3.0 failed this metric

FC064: Ensure issues_url is set in metadata: windows_network/metadata.rb:1
FC065: Ensure source_url is set in metadata: windows_network/metadata.rb:1
FC066: Ensure chef_version is set in metadata: windows_network/metadata.rb:1
FC069: Ensure standardized license defined in metadata: windows_network/metadata.rb:1
Run with Foodcritic Version 11.1.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

License Metric
            

0.3.0 failed this metric

windows_network does not have a valid open source license.
Acceptable licenses include Apache-2.0, apachev2, Apache 2.0, MIT, mit, GPL-2.0, gplv2, GNU Public License 2.0, GPL-3.0, gplv3, GNU Public License 3.0.

No Binaries Metric
            

0.3.0 passed this metric

Publish Metric
            

0.3.0 passed this metric

Supported Platforms Metric
            

0.3.0 passed this metric

Testing File Metric
            

0.3.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

0.3.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number