voxpupuli / puppet-network Goto Github PK
View Code? Open in Web Editor NEWTypes and providers to manage network interfaces
Home Page: https://forge.puppet.com/puppet/network
License: Apache License 2.0
Types and providers to manage network interfaces
Home Page: https://forge.puppet.com/puppet/network
License: Apache License 2.0
I'm observing some unusual behavior with Puppet is version 2.7.18 running on Ubuntu 12.10.
When puppet is run manually with puppet agent -t
or if the puppet daemon is restarted then the manifests runs fine, but after a few runs it starts throwing:
Could not prefetch network_config provider 'interfaces': Malformed debian interfaces file; cannot instantiate network_config resources
I suspect on machines configured to run the puppet agent from a cron job will not throw this error.
This is similar to what's reported in #44
network-scripts config files use 'yes' and 'no' for booleans, which adds the need for mapping. In addition, the BOOTPROTO value considers everything but 'bootp' or 'dhcp' to indicate static, so 'none' or 'static' is used. These values need to be normalized.
One of the features that has been asked for frequently is support for static network routes. This is a feature I hope to add, but I would like feedback on how the type should be implemented - that is, what are the types of information needed in the type. For example:
network_route { 'default':
family => 'inet',
type => 'network',
netmask => '0/0',
device => 'eth0',
gateway => '1.2.3.4',
metric => '0',
}
This is one suggested interface for the network_route type. What I need are example types like this and the expected output, so I can get an idea of what attributes need to be handled and how.
Pending: Puppet::Type::Network_config::ProviderInterfaces when parsing should parse out mapping lines # Not yet implemented # ./spec/unit/provider/network_config/interfaces_spec.rb:63 Puppet::Type::Network_config::ProviderInterfaces when parsing should parse out lines following mapping lines # Not yet implemented # ./spec/unit/provider/network_config/interfaces_spec.rb:64 Puppet::Type::Network_config::ProviderInterfaces when parsing should allow for multiple pre and post up sections # Not yet implemented # ./spec/unit/provider/network_config/interfaces_spec.rb:66 Puppet::Type::Network_config::ProviderRedhat when parsing the method property when static # Munging of BOOTPROTO none <-> static # ./spec/unit/provider/network_config/redhat_spec.rb:34 Puppet::Type::Network_config::ProviderRedhat when formatting resources with a valid configuration # Munging of onboot yes <-> true # ./spec/unit/provider/network_config/redhat_spec.rb:256 Puppet::Type::Network_config::ProviderRedhat when formatting resources with a valid configuration # Munging of BOOTPROTO none <-> static # ./spec/unit/provider/network_config/redhat_spec.rb:260 Puppet::Type::Network_config when validating the attribute options should be a descendant of the KeyValue property # on conversion to specific type # ./spec/unit/type/network_config_spec.rb:46 Puppet::Type::Network_config when validating the attribute value ipaddress should fail if a malformed address is used # implementation of IP address validation # ./spec/unit/type/network_config_spec.rb:81 Puppet::Type::Network_config when validating the attribute value ipaddress using the inet family should fail when passed an IPv6 address # implementation of IP address validation # ./spec/unit/type/network_config_spec.rb:65 Puppet::Type::Network_config when validating the attribute value ipaddress using the inet6 family should fail when passed an IPv4 address # implementation of IP address validation # ./spec/unit/type/network_config_spec.rb:75 Puppet::Type::Network_config when validating the attribute value netmask should validate a CIDR netmask # Not yet implemented # ./spec/unit/type/network_config_spec.rb:88 Puppet::Type::Network_config when validating the attribute value netmask should fail if an invalid CIDR netmask is used # implementation of IP address validation # ./spec/unit/type/network_config_spec.rb:89
Lame.
Windows can't use :
in file paths, which means that Bad Things (TM) happen when the repo is cloned down to Windows. The spec filenames should be sanitized.
I installed the package by calling puppet module install adrien-network
I've added a simple static entry to a node:
network_config { 'lo':
ensure => 'present',
family => 'inet',
method => 'loopback',
onboot => 'true',
}
deployment fails with the following error:
Could not autoload puppet/provider/network_config/interfaces: no such file to load -- puppetx/filemapper
Could not autoload puppet/type/network_config: Could not autoload puppet/provider/network_config/interfaces: no such file to load -- puppetx/filemapper
Could not autoload puppet/type/network_config: Could not autoload puppet/provider/network_config/interfaces: no such file to load -- puppetx/filemapper on node xxxx
filemapper
is installed inside /etc/puppet/modules/filemapper
I'd be happy to help debug the problem. I'm using puppet 3.4.3 & puppet-master 3.4.3.
List of installed packages:
$ sudo puppet module list
/etc/puppet/modules
├── adrien-boolean (v1.0.1)
├── adrien-filemapper (v1.1.2)
├── adrien-network (v0.4.1)
The parser tries to evaluate full IP netmask addresses but can only take in CIDR notation.
Skip the IPAddr.new('255.255.255.255').mask(value.strip.to_i).to_s line in lib/puppet/type/network_route.rb if netmask matches the IP regex.
It looks like the debian interfaces file can't handle:
auto lo
iface lo inet loopback
puppet resource network_config will throw
Error: Could not run: Malformed debian interfaces file; cannot instantiate network_config resources
As exposed by #9 and as demonstrated as a byproduct of #13, the :family
property doesn't actually make sense. Both Redhat and Debian both treat ipv6 configuration as separate from ipv4, and #9 demonstrates that in fact you can't have an IPv6 interface without an IPv6 interface.
The summary of this is that the :family
property needs to be deprecated and removed. In place of that, features should be used for this sort of thing. the :ipv4
feature will be a requirement for :ipaddress
and :netmask
, and the :ipv6
feature will be a requirement for the :ip6address
property.
...
notice: /Stage[main]/Rsyslog/Exec[Stop syslog]/returns: executed successfully
notice: /Stage[main]/Network/Network_config[eth2]/ipaddress: ipaddress changed '' to '10.10.10.114'
notice: /Stage[main]/Network/Network_config[eth2]/netmask: netmask changed '' to '255.255.255.0'
notice: /Stage[main]/Network/Network_config[eth2]/method: method changed 'dhcp' to 'static'
notice: /Stage[main]/Network/Network_config[eth2]/onboot: onboot changed 'false' to 'true'
notice: /Stage[main]/Network/Network_config[eth2]/hotplug: hotplug changed '' to 'true'
err: /Stage[main]/Network/Network_config[eth2]: Could not evaluate: Unable to support multiple interfaces [eth2,eth2] in a single file /etc/sysconfig/network-scripts/ifcfg-eth2
notice: Finished catalog run in 17.96 seconds
notice: Caught INT; calling stop
[root@grr network-scripts]# cat ifcfg-eth2*
Xen Virtual Ethernet
DEVICE=eth2
BOOTPROTO=dhcp
ONBOOT=no
HWADDR=d6:11:a6:10:f8:56
Xen Virtual Ethernet
DEVICE=eth2
BOOTPROTO=dhcp
ONBOOT=yes
HWADDR=22:77:d7:36:89:8f
BROADCAST=127.255.255.255
[root@grr network-scripts]# ls ifcfg-eth2*
ifcfg-eth2 ifcfg-eth2.bak
[root@grr network-scripts]# rm ifcfg-eth2.bak
rm: remove regular file `ifcfg-eth2.bak'? y
info: Applying configuration version '1366207647'
notice: /Stage[main]/Rsyslog/Exec[Stop syslog]/returns: executed successfully
notice: /Stage[main]/Network/Network_config[eth2]/ipaddress: ipaddress changed '' to '10.10.10.114'
notice: /Stage[main]/Network/Network_config[eth2]/netmask: netmask changed '' to '255.255.255.0'
notice: /Stage[main]/Network/Network_config[eth2]/method: method changed 'dhcp' to 'static'
notice: /Stage[main]/Network/Network_config[eth2]/onboot: onboot changed 'false' to 'true'
notice: /Stage[main]/Network/Network_config[eth2]/hotplug: hotplug changed '' to 'true'
info: FileBucket adding
{md5}
d7d7e6d693435d8f9bd8252a1b3fdb2a
notice: Finished catalog run in 11.87 seconds
Seems I cannot setup IPIP tunnel interfaces, this is often needed with IPVS.
As an alternative I was looking to set up alias interfaces, but seems I cannot?
In deploying a full replacement of the interfaces file with 3 interfaces defined, I either loose the eth1 "auto" inclusion, or loose all my interfaces in the auto line post puppet run.
(private_interface is eth0, external_interface is eth1)
network_config { "$::private_interface":
ensure => 'present',
hotplug => false,
family => 'inet',
ipaddress => "$::controller_node_address",
method => 'static',
netmask => "$::controller_node_netmask",
options => {
"dns-search" => "$::domain_name",
"dns-nameservers" => "$::cobbler_node_ip",
"gateway" => "$::node_gateway"
},
onboot => 'true',
notify => Service['networking'],
}
network_config { 'lo':
ensure => 'present',
hotplug => false,
family => 'inet',
method => 'loopback',
onboot => 'true',
notify => Service['networking'],
}
network_config { "$::external_interface":
ensure => 'present',
hotplug => false,
family => 'inet',
method => 'static',
ipaddress => '0.0.0.0',
netmask => '255.255.255.255',
onboot => 'true',
notify => Service['networking'],
}
service {'networking':
ensure => 'running',
restart => 'true',
}
produces something like:
root@compute1:~# cat /etc/network/interfaces
auto
allow-hotplug
iface eth0 inet static
netmask 255.255.255.0
address 192.168.25.10
dns-nameservers 192.168.25.254
dns-search dmz25.lab
gateway 192.168.25.1
iface eth1 inet static
netmask 255.255.255.255
address 0.0.0.0
down ifconfig eth1 down
up ifconfig eth1 up
iface lo inet loopback
It's highly desirable to be able to configure tagged vlan interfaces for a multiple of reasons but in particular when configuring a host to act as a Linux kernel based hypervisor. In the specific hypervisor scenario (under linux) there is normally a chain of interfaces like:
eth0 (raw interface) -> eth0.100 (802.1q tagged interfaces) -> br100 (bridge interface)
or
eth0/eth1/etc. (raw interfaces) -> bond0 (bond interface) -> eth0.100 (802.1q tagged interfaces) -> br100 (bridge interface)
The $::osfamily == debian
and redhat
configuration file approach for modeling the the relationship of the raw interfaces and the vlan interface are flexible but there is at least one syntax that is fairly similar between them.
On redhat
, the ifcfg configuration file DEVICE
variable provides both the name of the parent raw device and the vlan tag ID. The VLAN
variable also needs to be declared to invoke this magic device name parsing (it has not be tested if it it works without doing this but the VLAN
variable is required per the rhel documenation)
DEVICE=ethX.192
..
VLAN=yes
On debian
, the iface
declaration seems to declare the vlan tag (similar to the redhat DEVICE variable) but doesn't auto-magically seem to imply the parent raw device. A separate sub declaration of vlan-raw-device
is needed.
iface eth0.110 inet manual
vlan-raw-device eth0
Hey there, I have 4 facts that are relatively useful and I thought of joining them to this repository instead of opening a new one with just the facts.
The facts they expose are:
I'll attach the code in a comment as it is not that long...
Since the resolving #36 and #37 the network module no longer seems to be detecting interface configuration files in CentOS 6.4.
err: Could not prefetch network_config provider 'redhat': No resource and no name in property hash in redhat instance
notice: /Stage[main]//Node[login.tamaki.test.nesi.org.nz]/Network_config[eth0]/ensure: created
err: /Stage[main]//Node[login.tamaki.test.nesi.org.nz]/Network_config[eth0]: Could not evaluate: No resource and no name in property hash in redhat instance
err: /Stage[main]//Node[login.tamaki.test.nesi.org.nz]/Network_config[eth1]/ensure: change from absent to present failed: Puppet::Type::Network_config::ProviderRedhat is in an error state
Pending: Puppet::Type::Network_config when validating the attribute options should be a descendant of the KeyValue property # on conversion to specific type # ./spec/unit/type/network_config_spec.rb:46 Puppet::Type::Network_config when validating the attribute value ipaddress should fail if a malformed address is used # implementation of IP address validation # ./spec/unit/type/network_config_spec.rb:81 Puppet::Type::Network_config when validating the attribute value ipaddress using the inet family should fail when passed an IPv6 address # implementation of IP address validation # ./spec/unit/type/network_config_spec.rb:65 Puppet::Type::Network_config when validating the attribute value ipaddress using the inet6 family should fail when passed an IPv4 address # implementation of IP address validation # ./spec/unit/type/network_config_spec.rb:75 Puppet::Type::Network_config when validating the attribute value netmask should validate a CIDR netmask # Not yet implemented # ./spec/unit/type/network_config_spec.rb:88 Puppet::Type::Network_config when validating the attribute value netmask should fail if an invalid CIDR netmask is used # implementation of IP address validation # ./spec/unit/type/network_config_spec.rb:89
This should be not pending.
If a mapping section is encountered in /etc/network/interfaces, the parser bails out. At the very least it should store this configuration and restore it when the file is rewritten.
Failures: 1) Puppet::Type::Network_config::ProviderInterfaces when formatting writing the allow-hotplug section should allow at most one section Failure/Error: content.select {|line| line.match(/^allow-hotplug /)}.length.should == 1 NoMethodError: private method `select' called for # # ./spec/unit/provider/network_config/interfaces_spec.rb:117:in `block (4 levels) in ' 2) Puppet::Type::Network_config::ProviderInterfaces when formatting writing the allow-hotplug section should have the correct interfaces appended Failure/Error: content.find {|line| line.match(/^allow-hotplug /)}.should be_include("allow-hotplug eth0 lo") NoMethodError: undefined method `find' for # # ./spec/unit/provider/network_config/interfaces_spec.rb:121:in `block (4 levels) in ' 3) Puppet::Type::Network_config::ProviderInterfaces when formatting writing iface blocks should produce an iface block for each interface Failure/Error: content.select {|line| line.match(/iface eth0 inet static/)}.length.should == 1 NoMethodError: private method `select' called for # # ./spec/unit/provider/network_config/interfaces_spec.rb:129:in `block (4 levels) in '
If ifupdown-extras
isn't installed, then the network_route
provider will refuse to run. This is painfully hard to figure out. The existence of /etc/network/routes
in Debian is hardly documented at all, and the only mention of it in puppet-network is a comment in the implementation.
Interfaces should be able to explicitly enable/disable hotplugging if the back end provider supports it.
I've got the following config:
network_route { 'default':
ensure => 'present',
gateway => 10.0.0.2,
interface => 'bond0',
netmask => '0.0.0.0',
network => 'default',
}
resulting in the following file:
root@myserver:~# cat /etc/network/routes
default 0.0.0.0 10.0.0.2 bond0
default 0.0.0.0 10.0.0.2 bond0
and on each puppet agent -t run i get:
notice: /Stage[main]/Site000::Profiles::Network::Lacp/Network_route[default]/ensure: created
This is on ubuntu precise. ifupdown-extra is installed.
Fairly self-explanatory I guess. There's currently no support built in for the ONPARENT optiion of an interface alias. Useful for floating IP type vips that shouldn't automatically come up when the parent does.
[root@puppetski puppet-network]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)
[root@puppetski puppet-network]#
[root@puppetski puppet-network]# git pull
Already up-to-date.
[root@puppetski puppet-network]# git log -1
commit a137f37
Author: Adrien Thebo [email protected]
Date: Wed Mar 13 22:29:58 2013 -0700
Add puppet doc for network::bond
[root@puppetski puppet-network]# bundle exec rspec
.......................................................................................................................*._...............................FF_FFF*FFFFFFF.
Pending:
Puppet::Type::Network_config when validating the attribute options should be a descendant of the KeyValue property
# on conversion to specific type
# ./spec/unit/type/network_config_spec.rb:69
Puppet::Type::Network_config when validating the attribute value ipaddress should fail if a malformed address is used
# implementation of IP address validation
# ./spec/unit/type/network_config_spec.rb:104
Puppet::Type::Network_config when validating the attribute value ipaddress using the inet family should fail when passed an IPv6 address
# implementation of IP address validation
# ./spec/unit/type/network_config_spec.rb:88
Puppet::Type::Network_config when validating the attribute value ipaddress using the inet6 family should fail when passed an IPv4 address
# implementation of IP address validation
# ./spec/unit/type/network_config_spec.rb:98
Puppet::Type::Network_config when validating the attribute value netmask should validate a CIDR netmask
# Not yet implemented
# ./spec/unit/type/network_config_spec.rb:111
Puppet::Type::Network_config when validating the attribute value netmask should fail if an invalid CIDR netmask is used
# implementation of IP address validation
# ./spec/unit/type/network_config_spec.rb:112
network::bond::debian with default bonding params should add a network_config resource for bond0
# rspec-puppet support for unordered hash matching
# ./spec/defines/bond/debian_spec.rb:32
network::bond::debian with non-default bonding params should add a network_config resource for bond0
# rspec-puppet support for unordered hash matching
# ./spec/defines/bond/debian_spec.rb:77
Failures:
network::bond::debian with default bonding params should add a network_config resource for eth0
Failure/Error: should contain_network_config(slave).with_ensure('absent')
Puppet::Error:
Unknown function join at /tmp/puppet-network/spec/fixtures/modules/network/manifests/bond/debian.pp:28 on node puppetski.service.datapipe.net
network::bond::debian with default bonding params should add a network_config resource for eth1
Failure/Error: should contain_network_config(slave).with_ensure('absent')
Puppet::Error:
Unknown function join at /tmp/puppet-network/spec/fixtures/modules/network/manifests/bond/debian.pp:28 on node puppetski.service.datapipe.net
network::bond::debian with non-default bonding params should add a network_config resource for eth0
Failure/Error: should contain_network_config(slave).with_ensure('absent')
Puppet::Error:
Unknown function join at /tmp/puppet-network/spec/fixtures/modules/network/manifests/bond/debian.pp:28 on node puppetski.service.datapipe.net
network::bond::debian with non-default bonding params should add a network_config resource for eth1
Failure/Error: should contain_network_config(slave).with_ensure('absent')
Puppet::Error:
Unknown function join at /tmp/puppet-network/spec/fixtures/modules/network/manifests/bond/debian.pp:28 on node puppetski.service.datapipe.net
network::bond::debian with non-default bonding params should add a network_config resource for eth2
Failure/Error: should contain_network_config(slave).with_ensure('absent')
Puppet::Error:
Unknown function join at /tmp/puppet-network/spec/fixtures/modules/network/manifests/bond/debian.pp:28 on node puppetski.service.datapipe.net
network::bond on platform RedHat should create 'network::bond::redhat'
Failure/Error: should contain_network__bond__redhat('bond0')
Puppet::Error:
Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type kmod::alias at /tmp/puppet-network/spec/fixtures/modules/network/manifests/bond.pp:148 on node puppetski.service.datapipe.net
network::bond on platform RedHat should forward all options to 'network::bond::redhat'
Failure/Error: should contain_network__bond__redhat('bond0').with(params)
Puppet::Error:
Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type kmod::alias at /tmp/puppet-network/spec/fixtures/modules/network/manifests/bond.pp:148 on node puppetski.service.datapipe.net
network::bond on platform Debian should create 'network::bond::debian'
Failure/Error: should contain_network__bond__debian('bond0')
Puppet::Error:
Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type kmod::alias at /tmp/puppet-network/spec/fixtures/modules/network/manifests/bond.pp:148 on node puppetski.service.datapipe.net
network::bond on platform Debian should forward all options to 'network::bond::debian'
Failure/Error: should contain_network__bond__debian('bond0').with(params)
Puppet::Error:
Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type kmod::alias at /tmp/puppet-network/spec/fixtures/modules/network/manifests/bond.pp:148 on node puppetski.service.datapipe.net
network::bond on platform on an unsupported osfamily should fail to compile
Failure/Error: expect { subject }.to raise_error Puppet::Error, /network::bond does not support osfamily 'SparrowOS'/
expected Puppet::Error with message matching /network::bond does not support osfamily 'SparrowOS'/, got #<Puppet::Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type kmod::alias at /tmp/puppet-network/spec/fixtures/modules/network/manifests/bond.pp:148 on node puppetski.service.datapipe.net>
# ./spec/defines/bond_spec.rb:54
network::bond configuring the kernel bonding device
Failure/Error: it { should include_class('network::bond::setup') }
Puppet::Error:
Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type kmod::alias at /tmp/puppet-network/spec/fixtures/modules/network/manifests/bond.pp:148 on node puppetski.service.datapipe.net
# ./spec/defines/bond_spec.rb:62
network::bond configuring the kernel bonding device should add a kernel module alias for the bonded device
Failure/Error: })
Puppet::Error:
Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type kmod::alias at /tmp/puppet-network/spec/fixtures/modules/network/manifests/bond.pp:148 on node puppetski.service.datapipe.net
# ./spec/defines/bond_spec.rb:68
Finished in 3.13 seconds
172 examples, 12 failures, 8 pending
Failed examples:
rspec ./spec/defines/bond/debian_spec.rb:27 # network::bond::debian with default bonding params should add a network_config resource for eth0
rspec ./spec/defines/bond/debian_spec.rb:27 # network::bond::debian with default bonding params should add a network_config resource for eth1
rspec ./spec/defines/bond/debian_spec.rb:72 # network::bond::debian with non-default bonding params should add a network_config resource for eth0
rspec ./spec/defines/bond/debian_spec.rb:72 # network::bond::debian with non-default bonding params should add a network_config resource for eth1
rspec ./spec/defines/bond/debian_spec.rb:72 # network::bond::debian with non-default bonding params should add a network_config resource for eth2
rspec ./spec/defines/bond_spec.rb:29 # network::bond on platform RedHat should create 'network::bond::redhat'
rspec ./spec/defines/bond_spec.rb:33 # network::bond on platform RedHat should forward all options to 'network::bond::redhat'
rspec ./spec/defines/bond_spec.rb:41 # network::bond on platform Debian should create 'network::bond::debian'
rspec ./spec/defines/bond_spec.rb:45 # network::bond on platform Debian should forward all options to 'network::bond::debian'
rspec ./spec/defines/bond_spec.rb:53 # network::bond on platform on an unsupported osfamily should fail to compile
rspec ./spec/defines/bond_spec.rb:62 # network::bond configuring the kernel bonding device
rspec ./spec/defines/bond_spec.rb:64 # network::bond configuring the kernel bonding device should add a kernel module alias for the bonded device
[root@puppetski puppet-network]#
OS: RedHat
CHANGES TO CONFIGURATION: only by puppet
LOG:
...
/Network_config[bond0.126:111]/family: family changed '' to 'inet'
/Network_config[bond0.126:111]/onboot: onboot changed 'true' to 'true'
Info: FileBucket adding {md5}2ace49d5d0d14c1220b6d8a6b0cb0e72
Info: /Network_config[bond0.126:111]: Scheduling refresh of Service[network]
Info: /Network_config[bond0.126:111]: Scheduling refresh of Service[network]
...
Network refresh makes server unavailible for a couple seconds every puppet lunch without any changes to configuration.
Readme.md needs some additions in order to prevent stupid people like me from scratching their head at error messages like:
Error: /Stage[main]/Profiles::Portal::Webserver/Network_route[10.0.0.0]: Could not evaluate: 10.0.0.0 does not have a network.
Not all providers will respect the :options property, so this functionality should have to be explicitly turned on.
Adding an interface (eth0:0) with address families inet and inet6 is not possible, as this will result in a duplicate definition error message.
One possible solution would be, to add a parameter 'device'.
If I'm missing something, please let me know.
I'm using the following manifest:
network_config { 'lo':
ensure => 'present',
family => 'inet',
method => 'loopback',
onboot => 'true',
}
network_config { 'eth0':
ensure => 'present',
family => 'inet',
ipaddress => '10.4.8.23',
method => 'static',
netmask => '255.255.0.0',
onboot => 'true',
}
network_route { 'default':
ensure => 'present',
gateway => '10.4.0.1',
interface => 'eth0',
netmask => '0.0.0.0',
network => 'default',
}
In /etc/network/routes the route is getting added twice:
# HEADER: This file is is being managed by puppet. Changes to
# HEADER: routes that are not being managed by puppet will persist;
# HEADER: however changes to routes that are being managed by puppet will
# HEADER: be overwritten. In addition, file order is NOT guaranteed.
# HEADER: Last generated at: 2013-10-24 16:33:34 +0200
default 0.0.0.0 10.4.0.1 eth0
default 0.0.0.0 10.4.0.1 eth0
And on every puppet run I'm getting:
Notice: /Stage[main]//Network_route[default]/ensure: created
We have an issue where the network_config is giving a malformed debian interfaces file when reading the interfaces file.
Ive added some additional debugging into the code and narrowed it down to the code thinking it has seen an interface line twice
(
if match = line.match(/^iface\s+(\S+)\s+(\S+)\s+(\S+)/)
...
raise_malformed if Instance[name] and Instance[name].family
)
However, the line only occurs once in the file but seems to be seen twice.
It also does not happen on a regular basis, running it manually using puppet agent --test seems to work every time, but automated runs will fail.
puppet config:
network_config { 'lo:park':
ensure => 'present',
family => 'inet',
ipaddress => 'x.x.x.x',
method => 'static',
netmask => '255.255.255.255',
onboot => 'true',
}
network_config { 'lo:mta':
ensure => 'present',
family => 'inet',
ipaddress => 'x.x.x.x',
method => 'static',
netmask => '255.255.255.255',
onboot => 'true',
}
network_config { 'lo:inbound':
ensure => 'present',
family => 'inet',
ipaddress => 'x.x.x.x',
method => 'static',
netmask => '255.255.255.255',
onboot => 'true',
}
Note, however that these add fine, and the error is related to the eth0 line which is configured on the server rather than puppet:
iface eth0 inet static
address x.x.x.x
netmask 255.255.255.0
gateway x.x.x.x
As I mentioned this does work some of the time, so the file has been modified to look like this:
# HEADER: This file is is being managed by puppet. Changes to
# HEADER: interfaces that are not being managed by puppet will persist;
# HEADER: however changes to interfaces that are being managed by puppet will
# HEADER: be overwritten. In addition, file order is NOT guaranteed.
# HEADER: Last generated at: Thu Jun 13 10:48:50 +1200 2013
auto eth0 lo:park lo:inbound lo:mta
allow-hotplug lo:park lo:inbound lo:mta
iface eth0 inet static
address x.x.x.x
netmask 255.255.255.0
gateway x.x.x.x
iface lo inet loopback
iface lo:park inet static
address x.x.x.x
netmask 255.255.255.255
iface lo:inbound inet static
address x.x.x.x
netmask 255.255.255.255
iface lo:mta inet static
address x.x.x.x
netmask 255.255.255.255
My extra debugging determined that the line which originally set Instance[name] and Instance[name].family was:
iface eth0 inet static
and the line being processed when the if statement is tripped is:
iface eth0 inet static
Here's my scenario. I have a newly provisioned server with the loopback interface and em4 defined in /etc/network/interfaces. Puppet has never run on this server. I install puppet and it checks in with my puppet master and finds this in its catalog:
network_config { 'em4':
ensure => present,
method => manual,
onboot => false,
}
Sure enough, puppet runs and finds some things about this interface that need to change:
Nov 21 18:42:54 server01 puppet-agent[2147]: (/Stage[main]/Profiles::Server::Interfaces/Network_config[em4]/method) method changed 'dhcp' to 'manual'
Nov 21 18:42:54 server01 puppet-agent[2147]: (/Stage[main]/Profiles::Server::Interfaces/Network_config[em4]/hotplug) hotplug changed '' to 'true'
But, notice, it hasn't changed the onboot status. I check /etc/network/interfaces and it's still listed in the "auto" section. I run puppet resource network_config em4
and it returns:
user@server01:~$ sudo puppet resource network_config em4
network_config { 'em4':
ensure => 'present',
family => 'inet',
hotplug => 'true',
method => 'manual',
onboot => 'true',
}
So I run puppet again:
user@server01:~$ sudo puppet agent -tv
Info: Retrieving plugin
Info: Loading facts in /var/lib/puppet/lib/facter/postgres_default_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/rabbitmq_erlang_cookie.rb
Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
Info: Loading facts in /var/lib/puppet/lib/facter/iptables_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
Info: Loading facts in /var/lib/puppet/lib/facter/iptables_persistent_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/ip6tables_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
Info: Loading facts in /var/lib/puppet/lib/facter/os_maj_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/lvm_support.rb
Info: Loading facts in /var/lib/puppet/lib/facter/concat_basedir.rb
Info: Caching catalog for server01.domain.com
Info: Applying configuration version '1385058759'
Notice: Finished catalog run in 1.83 seconds
I'm at a loss on this one...
If I do:
network_route { '10.0.0.0/8':
ensure => 'present',
gateway => '192.168.63.1',
interface => 'eth0',
netmask => '8',
network => '10.0.0.0'
}
network_route { '192.168.0.0/16':
ensure => 'present',
gateway => '192.168.63.1',
interface => 'eth0',
netmask => '16',
network => '192.168.0.0'
}
network_route { 'default':
ensure => 'present',
gateway => '192.168.63.50',
interface => 'eth0',
netmask => '',
network => 'default'
}
I get this in /etc/sysconfig/network-scripts/route-eth0:
10.0.0.0/255.0.0.0 via 192.168.63.1 dev eth0
192.168.0.0/255.255.0.0 via 192.168.63.1 dev eth0
default via 192.168.63.50 dev eth0
Which doesn't actually work :(
The only valid format for that file, that I know of, is:
GATEWAY1=192.168.63.1
ADDRESS1=192.168.0.0
NETMASK1=255.255.0.0
GATEWAY2=192.168.63.1
ADDRESS2=10.0.0.0
NETMASK2=255.0.0.0
and unlike what I'd normally expect (like what firewall module does) - the routes are NOT setup at puppet agent runtime - but one needs to reboot (or reload networking).
The resulting routes, after reboot, looks like this:
192.168.63.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
192.168.0.0 192.168.63.1 255.255.0.0 UG 0 0 0 eth0
10.0.0.0 192.168.63.1 255.0.0.0 UG 0 0 0 eth0
0.0.0.0 192.168.63.1 0.0.0.0 UG 0 0 0 eth0
As far as I can see, the conclusions seem to be:
The first run of network_route on CentOS create a file in /etc/sysconfig/network-scripts with name
route-eth0
with some comments and all routes I set in the manifest. The 2nd run of the puppet agent
brings
Notice: /Stage[main]/Servernetz::Routen/Network_route[10.0.38.0]/ensure: created
Error: /Stage[main]/Servernetz::Routen/Network_route[10.0.38.0]: Could not evaluate: undefined method `[]' for nil:NilClass
This for all routes and nothing changes in the file. This behave is not, if the file does not exists or if there only comments in the file.
Any Idea?
plugin module 0.4.1
CentOs 6.5 x86_64
Puppet 3.4.2
rubyversion 1.8.7
Regards
CMe
I'm just starting with puppet, I'm not using puppet master, I just execute puppet apply directly on the node.
I've tried to add simple network_config to my node but puppet apply fails with:
Could not autoload network_config: no such file to load -- puppet/property/boolean at...
I'm using puppet 2.7.23 and librarian to manage modules, 'librarian-puppet show' outputs:
adrien/boolean (1.0.1)
adrien/filemapper (1.1.2)
adrien/network (0.4.1)
Any clues?
Thanks,
Pawel
I had accidently set:
other routes.. and then:
network_route { '10.97.0.0/16':
ensure => 'present',
gateway => '192.168.22.50',
interface => 'eth0',
netmask => '8',
network => '10.97.0.0'
}
Which wrote this in the route-eth0 file:
10.0.0.0/255.0.0.0 via 192.168.22.1 dev eth0
10.0.0.0/255.255.0.0 via 192.168.22.50 dev eth0
192.168.0.0/255.255.0.0 via 192.168.22.1 dev eth0
default via 192.168.22.50 dev eth0
When I then corrected it to netmask => 16 and network 10.97.0.0 - it spit out errors, instead of fixing it:
Could not evaluate: undefined method `[]' for nil:NilClass
For some reason every run of Puppet the /etc/sysconfig/network-scripts/ifcfg-* files managed by this module are "created", even if they already exist. This seems to be caused by the order of the lines in the file changing each time it is generated?
Here's a diff of one of the interface files showing how it changed between runs, although the key value pairings are all the same.
$ sudo diff --side-by-side /etc/sysconfig/network-scripts/ifcfg-lo\:1 /tmp/ifcfg-lo\:1 DEVICE=lo:1 | BOOTPROTO=loopback ONBOOT=yes ONBOOT=yes IPADDR=10.12.16.18 < NETMASK=255.255.255.255 NETMASK=255.255.255.255 > IPADDR=10.12.16.18 HOTPLUG=yes HOTPLUG=yes BOOTPROTO=loopback | DEVICE=lo:1
This is not causing a functional problem at the moment, however it does clutter the logs substantially.
Failures: 1) Puppet::Type::Network_config::ProviderInterfaces when formatting writing iface blocks should add all options following the iface block Failure/Error: content.split('\n').find {|line| line.match(/iface eth0/)}.should be_include(block) expected include?("iface eth0 inet static\naddress 169.254.0.1\nnetmask 255.255.0.0") to return true, got false # ./spec/unit/provider/network_config/interfaces_spec.rb:174 Finished in 0.5945 seconds 143 examples, 1 failure, 9 pending Failed examples: rspec ./spec/unit/provider/network_config/interfaces_spec.rb:168 # Puppet::Type::Network_config::ProviderInterfaces when formatting writing iface blocks should add all options following the iface block
This occurs when running on redhat version 6.3.
The umask used while running puppet module build
is used in the tarball and can mean that the installed files are unreadable by the puppet user if installed by root. There should be some sort of rake task to ensure that the module is built with the right umask.
It should not be assumed that any provider can reconfigure interfaces on the fly, and the :reconfigure parameter should depend on a feature being provided.
Debian allows multiple 'up' lines in iface stanza. They will be executed in the order written to the file.
But this isn't possible as there can only be one key in the options hash.
root@jafir:~# puppet agent -t --trace info: Retrieving plugin info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb info: Loading facts in /var/lib/puppet/lib/facter/confenv.rb info: Loading facts in /var/lib/puppet/lib/facter/bacula.rbinfo: Loading facts in /var/lib/puppet/lib/facter/certname.rbinfo: Loading facts in /var/lib/puppet/lib/facter/concat_basedir.rbinfo: Loading facts in /var/lib/puppet/lib/facter/root_home.rbinfo: Loading facts in /var/lib/puppet/lib/facter/lastuser.rbinfo: Loading facts in /var/lib/puppet/lib/facter/haszfs.rbinfo: Loading facts in /var/lib/puppet/lib/facter/systemid.rb info: Loading facts in /var/lib/puppet/lib/facter/printers.rb info: Caching catalog for jafir.dc1.puppetlabs.net info: Applying configuration version 'e4bc986' notice: /Stage[main]//Node[jafir]/Network_config[vlan1000]/ensure: created /var/lib/puppet/lib/puppet/provider/network_config/interfaces.rb:175:in `sort' /var/lib/puppet/lib/puppet/provider/network_config/interfaces.rb:175:in `format_resources' /var/lib/puppet/lib/puppet/provider/isomorphism.rb:169:in `flush' /var/lib/puppet/lib/puppet/provider/isomorphism.rb:44:in `flush' /usr/lib/ruby/1.8/puppet/type.rb:661:in `flush'/usr/lib/ruby/1.8/puppet/transaction/resource_harness.rb:139:in `evaluate'/usr/lib/ruby/1.8/puppet/transaction.rb:49:in `apply'/usr/lib/ruby/1.8/puppet/transaction.rb:84:in `eval_resource'/usr/lib/ruby/1.8/puppet/transaction.rb:104:in `evaluate'/usr/lib/ruby/1.8/puppet/util.rb:484:in `thinmark' /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime' /usr/lib/ruby/1.8/puppet/util.rb:483:in `thinmark' /usr/lib/ruby/1.8/puppet/transaction.rb:104:in `evaluate' /usr/lib/ruby/1.8/puppet/transaction.rb:386:in `traverse' /usr/lib/ruby/1.8/puppet/transaction.rb:99:in `evaluate' /usr/lib/ruby/1.8/puppet/resource/catalog.rb:141:in `apply' /usr/lib/ruby/1.8/puppet/configurer.rb:122:in `retrieve_and_apply_catalog' /usr/lib/ruby/1.8/puppet/util.rb:159:in `benchmark' /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime' /usr/lib/ruby/1.8/puppet/util.rb:158:in `benchmark' /usr/lib/ruby/1.8/puppet/configurer.rb:121:in `retrieve_and_apply_catalog' /usr/lib/ruby/1.8/puppet/configurer.rb:152:in `run'/usr/lib/ruby/1.8/puppet/agent.rb:43:in `run' /usr/lib/ruby/1.8/puppet/agent/locker.rb:21:in `lock' /usr/lib/ruby/1.8/puppet/agent.rb:43:in `run' /usr/lib/ruby/1.8/sync.rb:230:in `synchronize' /usr/lib/ruby/1.8/puppet/agent.rb:43:in `run' /usr/lib/ruby/1.8/puppet/agent.rb:95:in `with_client' /usr/lib/ruby/1.8/puppet/agent.rb:41:in `run' /usr/lib/ruby/1.8/puppet/application.rb:172:in `call' /usr/lib/ruby/1.8/puppet/application.rb:172:in `controlled_run' /usr/lib/ruby/1.8/puppet/agent.rb:39:in `run' /usr/lib/ruby/1.8/puppet/application/agent.rb:337:in `onetime' /usr/lib/ruby/1.8/puppet/application/agent.rb:311:in `run_command' /usr/lib/ruby/1.8/puppet/application.rb:309:in `run' /usr/lib/ruby/1.8/puppet/application.rb:416:in `hook' /usr/lib/ruby/1.8/puppet/application.rb:309:in `run' /usr/lib/ruby/1.8/puppet/application.rb:407:in `exit_on_fail' /usr/lib/ruby/1.8/puppet/application.rb:309:in `run' /usr/lib/ruby/1.8/puppet/util/command_line.rb:69:in `execute' /usr/bin/puppet:4 err: /Stage[main]//Node[jafir]/Network_config[vlan1000]: Could not evaluate: undefined method `<=>' for nil:NilClass notice: Finished catalog run in 4.58 seconds
OS: CentOS 6.3
Puppet version (client): 2.7.17
Puppet version (master): 3.0.0
puppet-network version: 0.4.0
I got the following error in my Puppet logs, but the interface is only defined once in the manifest. This is an intermittent error, it does not occur in a reproducible fashion AFAICT.
Sun May 19 03:39:24 +0000 2013 /Network_config[lo:6] (err): Could not evaluate: Unable to support multiple interfaces [lo:6,lo:6] in a single file /etc/sysconfig/network-scripts/ifcfg-lo:6
After which a new error popped up (although the odd "method static->loopback" behavior always happens even on "clean" runs):
Sun May 19 04:09:24 +0000 2013 /Network_config[lo:6]/method (notice): method changed 'static' to 'loopback' Sun May 19 04:09:24 +0000 2013 Puppet::Type::Network_config::ProviderRedhat (err): redhat is in an error state, refusing to flush file /etc/sysconfig/network-scripts/ifcfg-lo:6
Here's the manifest that is generating the ifcfg files.
class proxy::dev {
network_config { 'lo:1':
ensure => 'present',
family => 'inet',
method => 'loopback',
ipaddress => '10.12.16.18',
netmask => '255.255.255.255',
onboot => 'true',
reconfigure => 'true',
}
network_config { 'lo:2':
ensure => 'present',
family => 'inet',
method => 'loopback',
ipaddress => '10.12.16.19',
netmask => '255.255.255.255',
onboot => 'true',
reconfigure => 'true',
}
network_config { 'lo:3':
ensure => 'present',
family => 'inet',
method => 'loopback',
ipaddress => '10.12.16.20',
netmask => '255.255.255.255',
onboot => 'true',
reconfigure => 'true',
}
network_config { 'lo:4':
ensure => 'present',
family => 'inet',
method => 'loopback',
ipaddress => '10.12.16.21',
netmask => '255.255.255.255',
onboot => 'true',
reconfigure => 'true',
}
network_config { 'lo:5':
ensure => 'present',
family => 'inet',
method => 'loopback',
ipaddress => '10.12.16.22',
netmask => '255.255.255.255',
onboot => 'true',
reconfigure => 'true',
}
network_config { 'lo:6':
ensure => 'present',
family => 'inet',
method => 'loopback',
ipaddress => '10.12.16.23',
netmask => '255.255.255.255',
onboot => 'true',
reconfigure => 'true',
}
network_config { 'lo:7':
ensure => 'present',
family => 'inet',
method => 'loopback',
ipaddress => '10.12.16.24',
netmask => '255.255.255.255',
onboot => 'true',
reconfigure => 'true',
}
}
The ifcfg files created all look identical except for the fourth octet of the IP and the virtual interface identifier:
IPADDR=10.12.16.## DEVICE=lo:# ONBOOT=yes BOOTPROTO=loopback HOTPLUG=yes NETMASK=255.255.255.255
Hello,
# Bonded master interface - static:
# local
network::bond { 'bond0':
onboot => 'yes',
netmask => '255.255.0.0',
ipaddress => '172.16.1.101',
family => 'inet',
ensure => present,
method => 'none',
gateway => $defaultgateway,
bondingopt => 'mode=balance-rr miimon=100',
hotplug => 'no',
slaves => ['eth0','eth3',],
}
# redondance
network::bond { 'bond1':
onboot => 'yes',
netmask => '255.255.0.0',
ipaddress => '172.18.1.101',
family => 'inet',
ensure => present,
method => 'none',
gateway => '',
bondingopt => 'mode=balance-rr miimon=100',
hotplug => 'no',
slaves => ['eth1','eth2',],
}
This example work with this code
I have change
# = Define: network::bond
#
# Instantiate cross-platform bonded interfaces
#
# == Parameters
#
#
# == Examples
#
#
# network::bond { 'bond0':
# ipaddress => '172.16.1.2',
# netmask => '255.255.128.0',
# ensure => present,
# slaves => ['eth0', 'eth1'],
# }
#
# == See also
#
# * Linux Ethernet Bonding Driver HOWTO, Section 2 "Bonding Driver Options" http://www.kernel.org/doc/Documentation/networking/bonding.txt
#
define network::bond(
$slaves,
$ensure = present,
$ipaddress = undef,
$netmask = undef,
$method = undef,
$family = undef,
$onboot = undef,
$gateway = undef,
$bondingopt = undef,
$hotplug = undef,
) {
require network::bond::setup
kmod::alias { $name:
source => 'bonding',
ensure => $ensure,
}
case $osfamily {
Debian: {
network::bond::debian { $name:
slaves => $slaves,
ensure => $ensure,
ipaddress => $ipaddress,
netmask => $netmask,
family => $family,
onboot => $onboot,
require => Kmod::Alias[$name],
}
}
RedHat: {
network::bond::redhat { $name:
slaves => $slaves,
ensure => $ensure,
ipaddress => $ipaddress,
netmask => $netmask,
family => $family,
onboot => $onboot,
method => $method,
gateway => $gateway,
bondingopt => $bondingopt,
hotplug => $hotplug,
require => Kmod::Alias[$name],
}
}
}
}
I have change network::bond::redhat with
# = Define: network::bond::redhat
#
# Instantiate bonded interfaces on RedHat based systems.
#
# ==
define network::bond::redhat(
$slaves,
$ensure = present,
$ipaddress = undef,
$netmask = undef,
$gateway = '',
$method = undef,
$family = undef,
$onboot = undef,
$bondingopt = undef,
$hotplug = undef,
) {
network_config { $name:
ensure => $ensure,
ipaddress => $ipaddress,
netmask => $netmask,
family => $family,
onboot => $onboot,
method => $method,
hotplug => $hotplug,
options => {
'GATEWAY' => $gateway,
'BONDING_OPTS' => $bondingopt,
},
}
file { "/etc/sysconfig/network-scripts/ifcfg-$name":
ensure => present,
mode => '0644',
owner => 'root',
group => 'root',
require => Network_config[$name],
}
network::slave::redhat { $slaves:
ensure => $ensure,
master => $name,
require => [ Network_config[$name], File["/etc/sysconfig/network-scripts/ifcfg-$name"] ]
}
}
And i add network::slave::redhat
# = Define: network::bond::redhat::slave
#
# Instantiate bonded interfaces on RedHat based systems.
#
# ==
define network::slave::redhat (
$master,
$ensure = present,
$onboot = true,
$userctl = 'no',
$bootproto = 'none',
$hotplug = 'no',
) {
network_config { $name:
ensure => $ensure,
onboot => $onboot,
method => $bootproto,
hotplug => $hotplug,
options => {
'MASTER' => $master,
'SLAVE' => 'yes',
'HWADDR' => getvar("::macaddress_$name"),
'USERCTL' => $userctl,
}
}
file { "/etc/sysconfig/network-scripts/ifcfg-$name":
ensure => present,
mode => '0644',
owner => 'root',
group => 'root',
require => Network_config[$name],
}
}
Hi,
I am wondering if the dependencies to adrienthebo/puppet-filemapper and adrienthebo/puppet-boolean are part of the future, or the past of this module. Is this the direction you want to move towards, or something you would get rid of at some point?
I mean, you don't seem to solve anything that can't be solved with templates, and having additional dependencies make this module less clean... hope you agree (and somehow I think you won't xD)
Thanks!
If I set reconfigure => true,
in network_config class nothing happens. It should restart the networking service, or at least make a ifdown/ifup.
network_config { 'lo':
ensure => 'present',
family => 'inet',
method => 'loopback',
onboot => 'true',
}
root@foo:~# ralsh network_config lo | puppet apply
Parameter method failed: Invalid value "loopback". Valid values are static, manual, dhcp. at line 6
It seems method => loopback isn't supported at all?
The odd handling of allow-hotplug and allow-auto sections is causing those values to be improperly flushed.
root@ubuntu:/vagrant/puppet/manifests# puppet apply --trace /vagrant/puppet/manifests/test.pp` Error: Could not prefetch network_config provider 'interfaces': undefined method `[]' for nil:NilClass /etc/puppet/modules/network/lib/puppet/provider/network_config/interfaces.rb:164:in `parse_file' /etc/puppet/modules/network/lib/puppet/provider/network_config/interfaces.rb:59:in `each' /etc/puppet/modules/network/lib/puppet/provider/network_config/interfaces.rb:59:in `parse_file' /etc/puppet/modules/filemapper/lib/puppetx/filemapper.rb:157:in `load_all_providers_from_disk' /etc/puppet/modules/filemapper/lib/puppetx/filemapper.rb:156:in `each_pair' /etc/puppet/modules/filemapper/lib/puppetx/filemapper.rb:156:in `load_all_providers_from_disk' /etc/puppet/modules/filemapper/lib/puppetx/filemapper.rb:93:in `instances' /etc/puppet/modules/filemapper/lib/puppetx/filemapper.rb:179:in `prefetch' /usr/lib/ruby/vendor_ruby/puppet/transaction.rb:284:in `prefetch' /usr/lib/ruby/vendor_ruby/puppet/transaction.rb:272:in `prefetch_if_necessary' /usr/lib/ruby/vendor_ruby/puppet/transaction.rb:376:in `traverse' /usr/lib/ruby/vendor_ruby/puppet/transaction.rb:99:in `evaluate' /usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:144:in `apply' /usr/lib/ruby/vendor_ruby/puppet/configurer.rb:122:in `apply_catalog' /usr/lib/ruby/vendor_ruby/puppet/util.rb:179:in `benchmark' /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime' /usr/lib/ruby/vendor_ruby/puppet/util.rb:178:in `benchmark' /usr/lib/ruby/vendor_ruby/puppet/configurer.rb:121:in `apply_catalog' /usr/lib/ruby/vendor_ruby/puppet/configurer.rb:179:in `run' /usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:265:in `apply_catalog' /usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:213:in `main' /usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:146:in `run_command' /usr/lib/ruby/vendor_ruby/puppet/application.rb:346:in `run' /usr/lib/ruby/vendor_ruby/puppet/application.rb:438:in `plugin_hook' /usr/lib/ruby/vendor_ruby/puppet/application.rb:346:in `run' /usr/lib/ruby/vendor_ruby/puppet/util.rb:500:in `exit_on_fail' /usr/lib/ruby/vendor_ruby/puppet/application.rb:346:in `run' /usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:87:in `execute' /usr/bin/puppet:4
node default { network_config { 'eth1': ensure => 'present', family => 'inet', ipaddress => '192.168.50.2', method => 'static', netmask => '255.255.255.0', onboot => 'true', } }
root@ubuntu:/vagrant/puppet/manifests# ifconfig eth0 Link encap:Ethernet HWaddr 08:00:27:d2:e8:7b inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fed2:e87b/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:19865 errors:0 dropped:0 overruns:0 frame:0 TX packets:10612 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:10252479 (10.2 MB) TX bytes:1024905 (1.0 MB) eth1 Link encap:Ethernet HWaddr 08:00:27:9f:a6:0f inet addr:192.168.50.2 Bcast:192.168.50.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe9f:a60f/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1403 errors:0 dropped:0 overruns:0 frame:0 TX packets:695 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:273922 (273.9 KB) TX bytes:125286 (125.2 KB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:4 errors:0 dropped:0 overruns:0 frame:0 TX packets:4 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:260 (260.0 B) TX bytes:260 (260.0 B)
root@ubuntu:/vagrant/puppet/manifests# cat /etc/network/interfaces # HEADER: This file is is being managed by puppet. Changes to # HEADER: interfaces that are not being managed by puppet will persist; # HEADER: however changes to interfaces that are being managed by puppet will # HEADER: be overwritten. In addition, file order is NOT guaranteed. # HEADER: Last generated at: Tue Nov 27 01:11:36 +0200 2012 # The following interfaces will be started on boot auto eth0 eth1 lo iface eth0 inet dhcp allow-hotplug true pre-up sleep 2 iface eth1 inet static netmask 255.255.255.0 address 192.168.50.2 iface lo inet loopback
Redhat interfaces can use HOTPLUG=yes
to enable hotplugging for interfaces, this needs to be implemented for the redhat provider.
Automatic quoting of generic option strings with spaces should be added when writing, and stripped when reading.
Tested:
network_config { 'eth1':
ensure => 'present',
family => 'inet',
ipaddress => '169.254.0.1',
method => 'static',
netmask => '255.255.0.0',
onboot => 'true',
}
within my nodes.pp file under my host.
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not autoload puppet/type/network_config: no such file to load -- puppet/property/boolean on node myhost.example.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
I am running puppet 3.2.3
I have the boolean module installed.
Looks like it is setup on the host in:
/var/lib/puppet/lib/puppet/property/boolean.rb
If OpenVZ (or Virtuozzo) is being used for virtualization the facts network_nexthop_ip
, network_primary_interface
, and network_primary_ip
do not work because the default route is set to a (virtual) ethernet device instead of an IP address.
dev:~# facter virtual
openvz
dev:~# facter interfaces
lo,venet0,venet0_0
dev:~# /sbin/ip route show 0/0
default dev venet0 scope link
This leads to warnings on every Puppet run:
dev:~# puppet agent --noop -t
Info: Retrieving plugin
Info: Loading facts in /etc/puppet/modules/network/lib/facter/network.rb
[...]
need at least destination address
Could not retrieve network_primary_ip: private method `split' called for nil:NilClass
need at least destination address
Could not retrieve network_primary_ip: private method `split' called for nil:NilClass
need at least destination address
Could not retrieve network_primary_ip: private method `split' called for nil:NilClass
need at least destination address
Could not retrieve network_primary_interface: private method `split' called for nil:NilClass
need at least destination address
Could not retrieve network_primary_interface: private method `split' called for nil:NilClass
need at least destination address
Could not retrieve network_primary_interface: private method `split' called for nil:NilClass
[...]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.