Puppet Class: clustershell

Defined in:
manifests/init.pp

Summary

Manage clustershell

Overview

Examples:

include ::clustershell

Parameters:

  • fanout (Integer) (defaults to: 64)

    Value for clush.conf fanout

  • connect_timeout (Integer) (defaults to: 15)

    Value for clush.conf connect_timeout

  • command_timeout (Integer) (defaults to: 0)

    Value for clush.conf command_timeout

  • color (String) (defaults to: 'auto')

    Value for clush.conf color

  • fd_max (Integer) (defaults to: 8192)

    Value for clush.conf fd_max

  • history_size (Integer) (defaults to: 100)

    Value for clush.conf history_size

  • node_count (String) (defaults to: 'yes')

    Value for clush.conf node_count

  • verbosity (String) (defaults to: '1')

    Value for clush.conf verbosity

  • ssh_user (Optional[String]) (defaults to: undef)

    SSH user

  • ssh_path (String) (defaults to: 'ssh')

    Path to SSH command

  • ssh_options (String) (defaults to: '-oStrictHostKeyChecking=no')

    SSH options

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

    Module ensure property

  • package_name (String) (defaults to: 'clustershell')

    clustershell package name

  • package_ensure (Optional[String]) (defaults to: undef)

    The package ensure property, defaults based on ensure property

  • manage_epel (Boolean) (defaults to: true)

    Boolean that sets of EPEL module should be managed for Red Hat based systems

  • install_python (Boolean) (defaults to: false)

    Boolean that sets if python module should be installed

  • python_package_name (String[1]) (defaults to: 'python3-clustershell')

    Package name of python module, only applies to Red Hat based systems

  • conf_dir (Stdlib::Absolutepath) (defaults to: '/etc/clustershell')

    Path to clustershell configuration directory

  • conf (Stdlib::Absolutepath) (defaults to: '/etc/clustershell/clush.conf')

    Path to clush.conf

  • conf_template (String[1]) (defaults to: 'clustershell/clush.conf.erb')

    clush.conf template

  • defaults_conf (Stdlib::Absolutepath) (defaults to: '/etc/clustershell/defaults.conf')

    Path to defaults.conf

  • defaults_conf_template (String[1]) (defaults to: 'clustershell/defaults.conf.erb')

    defaults.conf template

  • groups_config (Stdlib::Absolutepath) (defaults to: '/etc/clustershell/groups.d/local.cfg')

    path to local.cfg groups config file

  • groups_concat_dir (Stdlib::Absolutepath) (defaults to: '/etc/clustershell/tmp')

    groups concat directory

  • groups_conf (Stdlib::Absolutepath) (defaults to: '/etc/clustershell/groups.conf')

    path to groups.conf

  • groups_conf_template (String[1]) (defaults to: 'clustershell/groups.conf.erb')

    groups.conf template

  • groups_auto_dir (Stdlib::Absolutepath) (defaults to: '/etc/clustershell/groups.d')

    path to groups auto directory

  • groups_conf_dir (Stdlib::Absolutepath) (defaults to: '/etc/clustershell/groups.conf.d')

    path to groups.conf.d

  • include_slurm_groups (Boolean) (defaults to: false)

    Boolean that sets if should include slurm groups

  • default_group_source (String) (defaults to: 'local')

    The default group source

  • default_distant_workername (String) (defaults to: 'ssh')

    The default remote command to use, usually ssh or rsh

  • groupmembers (Hash) (defaults to: {})

    Hash of resources to pass to clustershell::groupmember

  • group_yaml (Hash) (defaults to: {})

    Hash of resources to pass to clustershell::group_yaml

  • include_genders_groups (Boolean) (defaults to: false)

    Include genders group source

  • manage_genders (Boolean) (defaults to: true)

    Manage genders class when including genders group source



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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'manifests/init.pp', line 76

class clustershell (
  Integer $fanout = 64,
  Integer $connect_timeout = 15,
  Integer $command_timeout = 0,
  String $color = 'auto',
  Integer $fd_max = 8192,
  Integer $history_size = 100,
  String $node_count = 'yes',
  String $verbosity = '1',
  Optional[String] $ssh_user = undef,
  String $ssh_path = 'ssh',
  String $ssh_options = '-oStrictHostKeyChecking=no',
  Enum['present','absent'] $ensure = 'present',
  String $package_name = 'clustershell',
  Optional[String] $package_ensure = undef,
  Boolean $manage_epel = true,
  Boolean $install_python = false,
  String[1] $python_package_name = 'python3-clustershell',
  Stdlib::Absolutepath $conf_dir = '/etc/clustershell',
  Stdlib::Absolutepath $conf = '/etc/clustershell/clush.conf',
  String[1] $conf_template  = 'clustershell/clush.conf.erb',
  Stdlib::Absolutepath $defaults_conf = '/etc/clustershell/defaults.conf',
  String[1] $defaults_conf_template = 'clustershell/defaults.conf.erb',
  Stdlib::Absolutepath $groups_config = '/etc/clustershell/groups.d/local.cfg',
  Stdlib::Absolutepath $groups_concat_dir = '/etc/clustershell/tmp',
  Stdlib::Absolutepath $groups_conf = '/etc/clustershell/groups.conf',
  String[1] $groups_conf_template = 'clustershell/groups.conf.erb',
  Stdlib::Absolutepath $groups_auto_dir = '/etc/clustershell/groups.d',
  Stdlib::Absolutepath $groups_conf_dir = '/etc/clustershell/groups.conf.d',
  Boolean $include_slurm_groups = false,
  String $default_group_source = 'local',
  String $default_distant_workername = 'ssh',
  Hash $groupmembers = {},
  Hash $group_yaml = {},
  Boolean $include_genders_groups = false,
  Boolean $manage_genders = true,
) {
  if $ensure == 'absent' {
    $_package_ensure = pick($package_ensure, 'absent')
  } else {
    $_package_ensure = pick($package_ensure, 'present')
  }

  if dig($facts, 'os', 'family') == 'RedHat' {
    if $manage_epel {
      include epel
      $package_require = Yumrepo['epel']
    } else {
      $package_require = undef
    }
  } else {
    $package_require = undef
  }

  package { 'clustershell':
    ensure  => $_package_ensure,
    name    => $package_name,
    require => $package_require,
  }

  # Might need to convert to class
  if $install_python and $python_package_name {
    package { 'python-clustershell':
      ensure  => $_package_ensure,
      name    => $python_package_name,
      require => Package['clustershell'],
    }
  }

  file { '/etc/clustershell':
    ensure  => 'directory',
    path    => $conf_dir,
    owner   => 'root',
    group   => 'root',
    mode    => '0755',
    require => Package['clustershell'],
  }

  file { '/etc/clustershell/groups.conf.d':
    ensure => 'directory',
    path   => $groups_conf_dir,
    owner  => 'root',
    group  => 'root',
    mode   => '0755',
  }

  file { '/etc/clustershell/groups.d':
    ensure  => 'directory',
    path    => $groups_auto_dir,
    owner   => 'root',
    group   => 'root',
    mode    => '0755',
    purge   => true,
    recurse => true,
  }

  file { '/etc/clustershell/clush.conf':
    ensure  => 'file',
    path    => $conf,
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    require => File['/etc/clustershell'],
    content => template($conf_template),
  }

  file { '/etc/clustershell/defaults.conf':
    ensure  => 'file',
    path    => $defaults_conf,
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    content => template($defaults_conf_template),
  }

  file { '/etc/clustershell/groups.conf':
    ensure  => 'file',
    path    => $groups_conf,
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    content => template($groups_conf_template),
  }

  concat { '/etc/clustershell/groups.d/local.cfg':
    ensure  => 'present',
    path    => $groups_config,
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    require => File['/etc/clustershell/groups.d'],
  }
  concat::fragment { 'clustershell-groups.header':
    target  => '/etc/clustershell/groups.d/local.cfg',
    content => "### File managed by Puppet\n",
    order   => '01',
  }

  $groupmembers.each |$name, $data| {
    clustershell::groupmember { $name: * => $data }
  }
  $group_yaml.each |$name, $data| {
    clustershell::group_yaml { $name: * => $data }
  }

  if $include_slurm_groups {
    clustershell::group_source { 'slurm':
      ensure  => $ensure,
      map     => 'sinfo -h -o "%N" -p $GROUP',
      all     => 'sinfo -a -h -o "%N"',
      list    => 'sinfo -a -h -o "%P" | sed \'s|*||g\'',
      reverse => 'sinfo -a -h -N -o "%P" -n $NODE',
    }
  }

  if $include_genders_groups {
    if $manage_genders {
      include genders
      Class['genders'] -> Clustershell::Group_source['genders']
    }
    clustershell::group_source { 'genders':
      ensure => $ensure,
      map    => 'nodeattr -n $GROUP',
      all    => 'nodeattr -n -A',
      list   => 'nodeattr -l',
    }
  }
}