#
# Arguments
# $template: dhcp host template - default: 'dhcp/host.conf.erb'
-# $global_options: global options for the whole bunch of hosts.
+# $global_options: an array of global options for the whole bunch of hosts.
# you may override it per host, setting the host "options"
# directly in the hash.
# $subnet: targeted subnet
# $hash_data: hash containing data - default form:
# {
# <host1> => {
-# options => false,
-# fixed_address => false,
+# options => ['opt1', 'opt2'],
# interfaces => {
# eth0 => 'mac-address',
# eth1 => 'mac-address',
# }
# },
# <host2> => {
-# options => false,
-# fixed_address => false,
+# fixed_address => 'foo.example.com',
# interfaces => {
# eth0 => 'mac-address',
# eth1 => 'mac-address',
} }
it { should contain_concat__fragment('dhcp.host.My hosts').with(
+ :target => '/etc/dhcp/hosts.d/1.2.3.4.conf',
:content => /fixed-address host1;/
) }
end
} }
it { should contain_concat__fragment('dhcp.host.My hosts').with(
+ :target => '/etc/dhcp/hosts.d/1.2.3.4.conf',
:content => /foo;\nbar;\n/
) }
end
} }
it { should contain_concat__fragment('dhcp.host.My hosts').with(
+ :target => '/etc/dhcp/hosts.d/1.2.3.4.conf',
:content => /baz;\n/
) }
end
} }
it { should contain_concat__fragment('dhcp.host.My hosts').with(
+ :target => '/etc/dhcp/hosts.d/1.2.3.4.conf',
:content => /foo;\nbar;\n/
) }
end
:subnet => '1.2.3.4'
} }
- it { should contain_concat__fragment('dhcp.host.My hosts').with_content(
+ it { should contain_concat__fragment('dhcp.host.My hosts').with(
+ :target => '/etc/dhcp/hosts.d/1.2.3.4.conf').with_content(
/host host1-eth0 \{\n hardware ethernet 00:11:22:33:44:55;\n fixed-address host1;\n\}/).with_content(
/host host1-wlan0 \{\n hardware ethernet 00:aa:bb:44:55:ff;\n fixed-address host1;\n\}/).with_content(
/host host2-eth1 \{\n hardware ethernet 00:11:af:33:44:55;\n fixed-address foo\.example\.com;\n opt1;\n\}/)