Code Monkey home page Code Monkey logo

network_interfaces's Introduction

network_interfaces

Cookbook Version Travis status

Description

Manage /etc/network/interfaces on Debian/Ubuntu

Attributes

  • node['network_interfaces']['replace_orig'] - Replaces /etc/network/interfaces if set to true

Usage

example for a bridge with pre-up and pre-down script :

include_recipe 'network_interfaces'

network_interfaces 'br-test' do
  target '172.16.88.2'
  mask '255.255.255.0'
  bridge [ 'none' ]
  pre_up 'cat /tmp/iptables-create | iptables-restore -n'
  post_down 'cat /tmp/iptables-delete | iptables-restore -n'
end

More documentation later.

network_interfaces's People

Contributors

d-higuchi avatar damacus avatar eherot avatar guilhem avatar jeffbyrnes avatar kitchen-porter avatar meineerde avatar mhimmer avatar ramereth avatar realloc avatar renovate[bot] avatar sinfomicien avatar tas50 avatar vtolstov avatar xorima avatar xorimabot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

network_interfaces's Issues

Version 2.0

  • Provider for chef ifconfig
  • More generic options
    Using a generic Hash for anyone to add new option without having to do a PR

Support :delete action

It would be nice to ask LWRP to delete interface.d file and ifdown specified interface.

Deprecation warnings

Some warnings that the cookbook will break in near future versions.

         node.set is deprecated and will be removed in Chef 14, please use node.default/node.override (or node.normal only if you really need persistence) at 2 locations:
           - /tmp/kitchen/cache/cookbooks/network_interfaces/recipes/default.rb:25:in `from_file'
           - /tmp/kitchen/cache/cookbooks/network_interfaces/providers/default.rb:3:in `block in class_from_file'
          See https://docs.chef.io/deprecations_attributes.html for further details.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/checkout v4
  • actionshub/chef-install 3.0.0
  • actionshub/test-kitchen 3.0.0
.github/workflows/stale.yml
  • actions/stale v9

  • Check this box to trigger a request for Renovate to run again on this repository

The interface type/method can't be set

๐Ÿ‘ป Brief Description

The template for the interfaces contains @method variable but it is not set anywhere. We set @type which is unused.

I believe the problem was introduced with the change at 22520e9 : the template should have kept using @type as it already was.

๐Ÿฅž Cookbook version

Current latest git: 2baefb3

๐Ÿ‘ฉโ€๐Ÿณ Chef-Infra Version

16.12.3

๐ŸŽฉ Platform details

Ubuntu 18.04

Steps To Reproduce

include_recipe "network_interfaces"

network_interfaces "lo" do
  type 'loopback'
end

๐Ÿš“ Expected behavior

We should get iface lo inet loopback. Instead, the type is ignored.

Multiple value entries

Sorry to bug you again, thanks for the quick response last time!

I was wondering if it's possible to have multiple values such as for up/down? The easiest I guess would be to have them as an array? but they are strings.

Json:
"down": "ip r d 172.22.0.0/16 via 10.1.0.1 dev eth0",
"down": "ip r d 10.19.0.0/16 via 10.1.0.2 dev eth0"

Gives me only the first value.

"down": ["ip r d 172.22.0.0/16 via 10.1.0.1 dev eth0", "ip r d 10.19.0.0/16 via 10.1.0.2 dev eth0"]

Gives me "Option down must be a kind of String! You passed ["ip r d 172.22.0.0/16 via 10.1.0.1 dev eth0", "ip r d 10.19.0.0/16 via 10.1.0.2 dev eth0"]."

Please create default "interfaces" file

Hello,

first of, thanks for tackling the problem of handling /e/n/interfaces using Chef, this really fills a need.

One issue I noticed using Ubuntu 12.04: it won't find the cookbook_file for this platform, since it's not looking for it in files/debian{,-6}/ but in files/ubuntu{,-12.04}/ and files/default. Moving files/debian/interfaces to files/default/ works for Ubuntu 12.04 and I think it's then the intended behavior.

Thanks again,
Stephan

undefined method `bond=' for Chef::Resource::NetworkInterfaces

if I define resource from attributes

include_recipe "network_interfaces"
  node["netconf"]["interfaces"].each do |nic|
    network_interfaces nic[0] do
      ...
      bond nic[1]['bond'] if nic[1].attribute?('bond')
      ...
  end
end
Recipe: netconf::default
  * network_interfaces[bond0] action save

    ================================================================================
    Error executing action `save` on resource 'network_interfaces[bond0]'
    ================================================================================

    NoMethodError
    -------------
    undefined method `bond=' for Chef::Resource::NetworkInterfaces

    Cookbook Trace:
    ---------------
    /var/chef-solo/cookbooks/network_interfaces/providers/default.rb:12:in `block in class_from_file'

    Resource Declaration:
    ---------------------
    # In /var/chef-solo/cookbooks/netconf/recipes/default.rb

      8:   network_interfaces nic[0] do
      9:     target nic[1]['target'] if nic[1].attribute?('target')
     10:     network nic[1]['network'] if nic[1].attribute?('network')
     11:     mask nic[1]['mask'] if nic[1].attribute?('mask')
     12:     gateway nic[1]['gateway'] if nic[1].attribute?('gateway')
     13:     broadcast nic[1]['broadcast'] if nic[1].attribute?('broadcast')
     14:     bridge nic[1]['bridge'] if nic[1].attribute?('bridge')
     15:     bridge_stp nic[1]['bridge_stp'] if nic[1].attribute?('bridge_stp')
     16:     vlan_dev nic[1]['vlan_dev'] if nic[1].attribute?('vlan_dev')
     17:     bond nic[1]['bond'] if nic[1].attribute?('bond')
     18:     bond_mode nic[1]['bond_mode'] if nic[1].attribute?('bond_mode')
     19:     #metric nic[1]['metric'] if nic[1].attribute?('metric')
     20:     #mtu nic[1]['mtu'] if nic[1].attribute?('mtu')
     21:     pre_up nic[1]['pre_up'] if nic[1].attribute?('pre_up')
     22:     up nic[1]['up'] if nic[1].attribute?('up')
     23:     post_up nic[1]['post_up'] if nic[1].attribute?('post_up')
     24:     pre_down nic[1]['pre_down'] if nic[1].attribute?('pre_down')
     25:     down nic[1]['down'] if nic[1].attribute?('down')
     26:     post_down nic[1]['post_down'] if nic[1].attribute?('post_down')
     27:     custom nic[1]['custom'] if nic[1].attribute?('custom')
     28:   end
     29: end

    Compiled Resource:
    ------------------
    # Declared in /var/chef-solo/cookbooks/netconf/recipes/default.rb:8:in `block in from_file'

    network_interfaces("bond0") do
      action :save
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :network_interfaces
      cookbook_name :netconf
      recipe_name "default"
      bond ["none"]
      device "bond0"
    end

ruby_block[Merge interfaces] cannot be found in the resource collection

Hi!

Thanks for the cookbook, I just seem to be running into a weird issue. I am running the code in the ReadMe example. I get the same error no matter what I try.

ERROR: resource template[/etc/network/interfaces.d/br-test] is configured to notify resource ruby_block[Merge interfaces] with action create, but ruby_block[Merge interfaces] cannot be found in the resource collection. template[/etc/network/interfaces.d/br-test] is defined in /etc/chef/chef-solo-1/cookbooks/network_interfaces/providers/default.rb:37:in `block in class_from_file'

Is this something with my setup or the cookbook?

Update `line` dependency to something modern.

๐Ÿ™๐Ÿป Problem Statement

The line dependency being used is at some ancient version. If user specifies their own version, we fail to resolve:

- `line (~> 2.9)` required by `user-specified dependency`
โ€ฆ
- `line (~> 0.6.1)` required by `network_interfaces-1.0.2`
- `line (>= 2.0.0)` required by `nfs-2.6.0`

โ” Possible Solution

Widen the bounds on line.

โคด๏ธ Describe alternatives you've considered

Using own patched fork.

Unclear license

in your recipes/default.rb you state

All rights reserved - Do Not Redistribute

This is not in line with the Apache 2.0 license stated in your metadata.rb. Could you please clarify this? Only then I (and anyone not being you) would be able to use this cookbook which actually looks rather awesome :)

Gatewayes not created

network_interfaces-cookbook/providers/default.rb is missing a line that sets the gateway, patch:

diff --git a/cookbooks/network_interfaces/providers/default.rb b/cookbooks/netwo
index 2911a83..263a575 100644
--- a/cookbooks/network_interfaces/providers/default.rb
+++ b/cookbooks/network_interfaces/providers/default.rb
@@ -37,6 +37,7 @@ action :save do
:address => new_resource.target,
:network => new_resource.network,
:netmask => new_resource.mask,

  •  :gateway => new_resource.gateway,
    
    :bridge_ports => new_resource.bridge,
    :metric => new_resource.metric,
    :mtu => new_resource.mtu,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.