Skip to content

Commit

Permalink
More updates
Browse files Browse the repository at this point in the history
  • Loading branch information
treydock committed Oct 6, 2024
1 parent de25ed4 commit 5a227a4
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 63 deletions.
18 changes: 8 additions & 10 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
fixtures:
repositories:
forge_modules:
yumrepo_core:
repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git
repo: puppetlabs/yumrepo_core
stdlib:
repo: https://github.com/puppetlabs/puppetlabs-stdlib.git
ref: v8.6.0
repo: puppetlabs/stdlib
augeasproviders_core:
repo: https://github.com/voxpupuli/puppet-augeasproviders_core.git
repo: puppet/augeasproviders_core
augeasproviders_shellvar:
repo: https://github.com/voxpupuli/puppet-augeasproviders_shellvar.git
repo: puppet/augeasproviders_shellvar
systemd:
repo: https://github.com/voxpupuli/puppet-systemd.git
repo: puppet/systemd
rsyslog:
repo: https://github.com/saz/puppet-rsyslog.git
repo: saz/rsyslog
network:
repo: https://github.com/voxpupuli/puppet-network.git
ref: v2.1.0
repo: puppet/network
symlinks:
mofed: "#{source_dir}"
77 changes: 34 additions & 43 deletions manifests/interface.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
Optional[Stdlib::IP::Address] $netmask = undef ,
Optional[Stdlib::IP::Address] $gateway = undef,
Boolean $enable = true,
Optional[Variant[Boolean, Enum['yes','no']]] $nm_controlled = undef,
Optional[Enum['yes','no']] $nm_controlled = undef,
Enum['yes', 'no'] $connected_mode = 'yes',
Optional[Integer] $mtu = undef,
Boolean $bonding = false,
Expand All @@ -55,20 +55,10 @@

include mofed

$onboot = $enable ? {
true => 'yes',
false => 'no',
default => $enable,
}

$options_extra_redhat = {
'CONNECTED_MODE' => $connected_mode,
}

if $facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'], '8') >= 0 {
$_nm_controlled = pick($nm_controlled, false)
} else {
if $mofed::osfamily == 'RedHat' and versioncmp($mofed::osmajor, '7') == 0 {
$_nm_controlled = pick($nm_controlled, 'no')
} else {
$_nm_controlled = $nm_controlled
}

if $bonding {
Expand All @@ -79,53 +69,54 @@
# Setup interfaces for the slaves
$bonding_slaves.each |String $ifname| {
network_config { $ifname:
ensure => $ensure,
onboot => $onboot,
master => $name,
slave => 'yes',
mtu => $mtu,
method => 'static',
hotplug => 'false',
options => {
ensure => $ensure,
onboot => $enable,
mtu => $mtu,
method => 'static',
hotplug => false,
options => {
'TYPE' => 'Infiniband',
'MASTER' => $name,
'SLAVE' => 'yes',
'NM_CONTROLLED' => $_nm_controlled,
'CONNECTED_MODE' => $connected_mode,
}
}.filter |$k, $v| { $v =~ NotUndef },
}
}

# Setup the bonding interface
network_config { $name:
ensure => $ensure,
onboot => $onboot,
ipaddress => $ipaddr,
netmask => $netmask,
bonding_master => 'yes',
bonding_opts => $bonding_opts,
mtu => $mtu,
method => 'static',
hotplug => 'false',
options => {
ensure => $ensure,
onboot => $enable,
ipaddress => $ipaddr,
netmask => $netmask,
mtu => $mtu,
method => 'static',
hotplug => false,
options => {
'TYPE' => 'Infiniband',
'BONDING_MASTER' => 'yes',
'BONDING_OPTS' => $bonding_opts,
'NM_CONTROLLED' => $_nm_controlled,
'GATEWAY' => $gateway,
'CONNECTED_MODE' => $connected_mode,
}
}.filter |$k, $v| { $v =~ NotUndef },
}
} else {
network_config { $name:
ensure => $ensure,
onboot => $onboot,
ipaddress => $ipaddr,
netmask => $netmask,
mtu => $mtu,
method => 'static',
hotplug => 'false',
options => {
ensure => $ensure,
onboot => $enable,
ipaddress => $ipaddr,
netmask => $netmask,
mtu => $mtu,
method => 'static',
hotplug => false,
options => {
'TYPE' => 'Infiniband',
'GATEWAY' => $gateway,
'NM_CONTROLLED' => $_nm_controlled,
'CONNECTED_MODE' => $connected_mode,
}
}.filter |$k, $v| { $v =~ NotUndef },
}
}
}
5 changes: 4 additions & 1 deletion manifests/opensm.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@
'present': {
$package_ensure = 'present'
$file_ensure = 'file'
$unit_ensure = 'present'
$service_ensure = 'running'
$service_enable = true
}
'absent': {
$package_ensure = 'absent'
$file_ensure = 'absent'
$unit_ensure = 'absent'
$service_ensure = 'stopped'
$service_enable = false
}
'disabled': {
$package_ensure = 'present'
$file_ensure = 'file'
$unit_ensure = 'present'
$service_ensure = 'stopped'
$service_enable = false
}
Expand Down Expand Up @@ -82,7 +85,7 @@
}

systemd::unit_file { '[email protected]':
ensure => $file_ensure,
ensure => $unit_ensure,
source => 'puppet:///modules/mofed/opensm/[email protected]',
}

Expand Down
8 changes: 1 addition & 7 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@
class mofed::service {
assert_private()

if $mofed::openibd_service_enable in ['UNSET', 'undef'] {
$_enable = undef
} else {
$_enable = $mofed::openibd_service_enable
}

if $mofed::manage_service {
service { 'openibd':
ensure => $mofed::openibd_service_ensure,
enable => $_enable,
enable => $mofed::openibd_service_enable,
name => $mofed::openibd_service_name,
hasstatus => $mofed::openibd_service_hasstatus,
hasrestart => $mofed::openibd_service_hasrestart,
Expand Down
5 changes: 4 additions & 1 deletion manifests/srp.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,23 @@
$package_ensure = 'present'
$file_ensure = 'file'
$srp_load = 'yes'
$unit_ensure = 'present'
$service_ensure = 'running'
$service_enable = true
}
'absent': {
$package_ensure = 'absent'
$file_ensure = 'absent'
$srp_load = 'no'
$unit_ensure = 'absent'
$service_ensure = 'stopped'
$service_enable = false
}
'disabled': {
$package_ensure = 'present'
$file_ensure = 'file'
$srp_load = 'yes'
$unit_ensure = 'present'
$service_ensure = 'stopped'
$service_enable = false
}
Expand Down Expand Up @@ -138,7 +141,7 @@
}

systemd::unit_file { '[email protected]':
ensure => $file_ensure,
ensure => $unit_ensure,
source => 'puppet:///modules/mofed/srp/[email protected]',
}

Expand Down
2 changes: 1 addition & 1 deletion spec/classes/opensm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

if facts[:operatingsystemrelease].to_i >= 7.0
it do
is_expected.to contain_systemd__unit_file('[email protected]').with_ensure('file')
is_expected.to contain_systemd__unit_file('[email protected]').with_ensure('present')
end

it do
Expand Down

0 comments on commit 5a227a4

Please sign in to comment.