Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ Normal interface - dhcp:
ethtool_opts => 'autoneg off speed 100 duplex full',
}

Normal interface - dhcp with custom DNS servers (peerdns must be true):

network::if::dynamic { 'eth0':
ensure => 'up',
peerdns => true,
dns1 => '8.8.8.8',
dns2 => '8.8.4.4',
}

Normal interface - bootp (minimal):

network::if::dynamic { 'eth2':
Expand Down
6 changes: 6 additions & 0 deletions manifests/if/dynamic.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# $dhcp_hostname - optional
# $ethtool_opts - optional
# $peerdns - optional
# $dns1 - optional - only used when peerdns is true
# $dns2 - optional - only used when peerdns is true
# $linkdelay - optional
# $check_link_down - optional
# $zone - optional
Expand Down Expand Up @@ -55,6 +57,8 @@
$dhcp_hostname = undef,
$ethtool_opts = undef,
$peerdns = false,
$dns1 = undef,
$dns2 = undef,
$linkdelay = undef,
$check_link_down = false,
$defroute = undef,
Expand Down Expand Up @@ -91,6 +95,8 @@
dhcp_hostname => $dhcp_hostname,
ethtool_opts => $ethtool_opts,
peerdns => $peerdns,
dns1 => $dns1,
dns2 => $dns2,
linkdelay => $linkdelay,
check_link_down => $check_link_down,
defroute => $defroute,
Expand Down
31 changes: 31 additions & 0 deletions spec/defines/network_if_dynamic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,5 +164,36 @@
it { should contain_service('network') }
end

context 'optional parameters - custom dns' do
let(:title) { 'eth0' }
let :params do {
:ensure => 'up',
:peerdns => true,
:dns1 => '8.8.8.8',
:dns2 => '8.8.4.4'
}
end
let :facts do {
:osfamily => 'RedHat',
}
end
it { should contain_file('ifcfg-eth0').with(
:ensure => 'present',
:mode => '0644',
:owner => 'root',
:group => 'root',
:path => '/etc/sysconfig/network-scripts/ifcfg-eth0',
:notify => 'Service[network]'
)}
it 'should contain File[ifcfg-eth0] with required contents' do
verify_contents(catalogue, 'ifcfg-eth0', [
'DEVICE=eth0',
'PEERDNS=yes',
'DNS1=8.8.8.8',
'DNS2=8.8.4.4',
])
end
it { should contain_service('network') }
end

end