34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
# File 'manifests/interface.pp', line 34
define mofed::interface(
Enum['present', 'absent'] $ensure = 'present',
Optional[Stdlib::Compat::Ip_address] $ipaddr = undef,
Optional[Stdlib::Compat::Ip_address] $netmask = undef ,
Optional[Stdlib::Compat::Ip_address] $gateway = undef,
Boolean $enable = true,
Optional[Variant[Boolean, Enum['yes','no']]] $nm_controlled = undef,
Enum['yes', 'no'] $connected_mode = 'yes',
Optional[Integer] $mtu = undef,
Boolean $bonding = false,
Array[String] $bonding_slaves = [],
String $bonding_opts = 'mode=active-backup miimon=100',
) {
if $ensure == 'present' {
if ! $ipaddr {
fail('ipaddr is required with ensure=present')
}
if ! $netmask {
fail('netmask is required with ensure=present')
}
}
include mofed
$onboot = $enable ? {
true => 'yes',
false => 'no',
default => $enable,
}
$options_extra_redhat = {
'CONNECTED_MODE' => $connected_mode,
}
if $mofed::osfamily == 'RedHat' and versioncmp($mofed::osmajor, '8') >= 0 {
$_nm_controlled = pick($nm_controlled, false)
} else {
$_nm_controlled = pick($nm_controlled, 'no')
}
if $bonding {
if empty($bonding_slaves) {
fail("No slave interfaces given for bonding interface ${name}")
}
# Setup interfaces for the slaves
$bonding_slaves.each |String $ifname| {
network::interface { $ifname:
ensure => $ensure,
enable => $enable,
onboot => $onboot,
type => 'InfiniBand',
master => $name,
slave => 'yes',
nm_controlled => $_nm_controlled,
mtu => $mtu,
options_extra_redhat => $options_extra_redhat,
}
}
# Setup the bonding interface
network::interface { $name:
ensure => $ensure,
enable => $enable,
onboot => $onboot,
type => 'Bond',
ipaddress => $ipaddr,
netmask => $netmask,
gateway => $gateway,
bonding_master => 'yes',
bonding_opts => $bonding_opts,
nm_controlled => $_nm_controlled,
mtu => $mtu,
}
} else {
network::interface { $name:
ensure => $ensure,
enable => $enable,
onboot => $onboot,
type => 'InfiniBand',
ipaddress => $ipaddr,
netmask => $netmask,
gateway => $gateway,
nm_controlled => $_nm_controlled,
mtu => $mtu,
options_extra_redhat => $options_extra_redhat,
}
}
}
|