Defined Type: infiniband::interface

Defined in:
manifests/interface.pp

Summary

Manage IPoIB interface

Overview

Examples:

Creates the ifcfg file for an IBoIP interface

infiniband::interface { 'ib0':
  ipaddr  => '192.168.1.1',
  netmask => '255.255.255.0',
}

Parameters:

  • name

    The resource title. Sets the interfaces name, for example 'ib0'.

  • ipaddr (Stdlib::Compat::Ip_address)

    The IPADDR for the infiniband interface.

  • netmask (Stdlib::Compat::Ip_address)

    The NETMASK for the infiniband interface.

  • gateway (Optional[Stdlib::Compat::Ip_address]) (defaults to: undef)

    The GATEWAY for the infiniband interface.

  • ensure (Enum['present', 'absent']) (defaults to: 'present')

    Sets if the infiniband::interface should be present or absent.

  • enable (Boolean) (defaults to: true)

    Sets if the infiniband::interface should be enabled at boot.

  • nm_controlled (Optional[Variant[Boolean, Enum['yes','no']]]) (defaults to: undef)

    Value for nm_controlled on interface

  • connected_mode (Enum['yes', 'no']) (defaults to: 'yes')

    The CONNECTED_MODE value for the infiniband interface.

  • mtu (Optional[Integer]) (defaults to: undef)

    The MTU for the infiniband interface.

  • bonding (Boolean) (defaults to: false)

    If this interface is a bonding interface (true/false); defaults to false

  • bonding_slaves (Array[String]) (defaults to: [])

    Array of interfaces that should be enslaved in the bonding interface

  • bonding_opts (String) (defaults to: 'mode=active-backup miimon=100')

    The bonding options to use for this bonding interface



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,
    }
  }

}