| 
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 | # File 'manifests/init.pp', line 84
class lmod (
  Enum['present','absent'] $ensure                  = 'present',
  String $version                                   = '8.4.26',
  String $package_ensure                            = 'present',
  Stdlib::Absolutepath $prefix                      = '/usr/share',
  Enum['package','source','none'] $install_method   = 'package',
  Boolean $manage_epel                              = true,
  Stdlib::Absolutepath $source_dir                  = '/usr/src',
  Hash $source_with_flags                           = {},
  String $package_name                              = 'Lmod',
  Array $runtime_packages                           = [],
  Array $build_packages                             = [],
  Boolean $manage_alternatives                      = true,
  Optional[Stdlib::Absolutepath] $modulepath_root   = undef,
  Array $modulepaths                                = ['$LMOD_sys', 'Core'],
  Boolean $set_lmod_package_path                    = false,
  String $lmod_package_path                         = '$MODULEPATH_ROOT/Site',
  Boolean $set_default_module                       = false,
  String $default_module                            = 'StdEnv',
  Array $avail_styles                               = ['system'],
  Optional[Stdlib::Absolutepath] $lmod_admin_file   = undef,
  Optional[String] $system_name                     = undef,
  Optional[String] $site_name                       = undef,
  Optional[Boolean] $cached_loads                   = undef,
  Stdlib::Absolutepath $modules_bash_path           = '/etc/profile.d/modules.sh',
  String $modules_bash_template                     = 'lmod/modules.sh.erb',
  Optional[String] $modules_bash_source             = undef,
  Stdlib::Absolutepath $modules_csh_path            = '/etc/profile.d/modules.csh',
  String $modules_csh_template                      = 'lmod/modules.csh.erb',
  Optional[String] $modules_csh_source              = undef,
  Stdlib::Absolutepath $stdenv_bash_path            = '/etc/profile.d/z00_StdEnv.sh',
  String $stdenv_bash_template                      = 'lmod/z00_StdEnv.sh.erb',
  Optional[String] $stdenv_bash_source              = undef,
  Stdlib::Absolutepath $stdenv_csh_path             = '/etc/profile.d/z00_StdEnv.csh',
  String $stdenv_csh_template                       = 'lmod/z00_StdEnv.csh.erb',
  Optional[String] $stdenv_csh_source               = undef,
) {
  case $ensure {
    'present': {
      $_file_ensure = 'file'
    }
    'absent': {
      $_file_ensure = 'absent'
    }
    default: {
      # Do nothing
    }
  }
  if $modules_bash_source {
    $_modules_bash_source   = $modules_bash_source
    $_modules_bash_content  = undef
  } else {
    $_modules_bash_source   = undef
    $_modules_bash_content  = template($modules_bash_template)
  }
  if $modules_csh_source {
    $_modules_csh_source   = $modules_csh_source
    $_modules_csh_content  = undef
  } else {
    $_modules_csh_source   = undef
    $_modules_csh_content  = template($modules_csh_template)
  }
  if $stdenv_bash_source {
    $_stdenv_bash_source   = $stdenv_bash_source
    $_stdenv_bash_content  = undef
  } else {
    $_stdenv_bash_source   = undef
    $_stdenv_bash_content  = template($stdenv_bash_template)
  }
  if $stdenv_csh_source {
    $_stdenv_csh_source   = $stdenv_csh_source
    $_stdenv_csh_content  = undef
  } else {
    $_stdenv_csh_source   = undef
    $_stdenv_csh_content  = template($stdenv_csh_template)
  }
  contain 'lmod::install'
  contain 'lmod::load'
  Class['lmod::install']
  -> Class['lmod::load']
} |