diff --git a/.fixtures.yml b/.fixtures.yml index cd7bd5f..140a0fc 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -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}" diff --git a/manifests/interface.pp b/manifests/interface.pp index 07a2f2b..95ddd3f 100644 --- a/manifests/interface.pp +++ b/manifests/interface.pp @@ -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, @@ -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 { @@ -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 }, } } } diff --git a/manifests/opensm.pp b/manifests/opensm.pp index 437c6a6..25b4e6a 100644 --- a/manifests/opensm.pp +++ b/manifests/opensm.pp @@ -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 } @@ -82,7 +85,7 @@ } systemd::unit_file { 'opensmd@.service': - ensure => $file_ensure, + ensure => $unit_ensure, source => 'puppet:///modules/mofed/opensm/opensmd@.service', } diff --git a/manifests/service.pp b/manifests/service.pp index 5df6848..47e0195 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -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, diff --git a/manifests/srp.pp b/manifests/srp.pp index c8019f7..eff90b6 100644 --- a/manifests/srp.pp +++ b/manifests/srp.pp @@ -29,6 +29,7 @@ $package_ensure = 'present' $file_ensure = 'file' $srp_load = 'yes' + $unit_ensure = 'present' $service_ensure = 'running' $service_enable = true } @@ -36,6 +37,7 @@ $package_ensure = 'absent' $file_ensure = 'absent' $srp_load = 'no' + $unit_ensure = 'absent' $service_ensure = 'stopped' $service_enable = false } @@ -43,6 +45,7 @@ $package_ensure = 'present' $file_ensure = 'file' $srp_load = 'yes' + $unit_ensure = 'present' $service_ensure = 'stopped' $service_enable = false } @@ -138,7 +141,7 @@ } systemd::unit_file { 'srpd@.service': - ensure => $file_ensure, + ensure => $unit_ensure, source => 'puppet:///modules/mofed/srp/srpd@.service', } diff --git a/spec/classes/opensm_spec.rb b/spec/classes/opensm_spec.rb index 0d89ced..97966d7 100644 --- a/spec/classes/opensm_spec.rb +++ b/spec/classes/opensm_spec.rb @@ -72,7 +72,7 @@ if facts[:operatingsystemrelease].to_i >= 7.0 it do - is_expected.to contain_systemd__unit_file('opensmd@.service').with_ensure('file') + is_expected.to contain_systemd__unit_file('opensmd@.service').with_ensure('present') end it do