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
|
# File 'manifests/interface.pp', line 35
define infiniband::interface (
Stdlib::Compat::Ip_address $ipaddr,
Stdlib::Compat::Ip_address $netmask,
Optional[Stdlib::Compat::Ip_address] $gateway = undef,
Enum['present', 'absent'] $ensure = 'present',
Boolean $enable = true,
Enum['yes', 'no'] $connected_mode = 'yes',
Optional[Variant[Boolean, Enum['yes','no']]] $nm_controlled = undef,
Optional[Integer] $mtu = undef,
Boolean $bonding = false,
Array[String] $bonding_slaves = [],
String $bonding_opts = 'mode=active-backup miimon=100',
) {
$onboot = $enable ? {
String => $enable,
Boolean => $enable ? {
true => 'yes',
false => 'no',
},
}
$options_extra_redhat = {
'CONNECTED_MODE' => $connected_mode,
}
if $::osfamily == 'RedHat' and versioncmp($::operatingsystemmajrelease, '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,
}
}
}
|