idiv_biodiversity.lmod
Ansible Role: Lmod
This Ansible role helps in installing Lmod from its source code.
It is designed for easy installation on HPC clusters. You can install the Lmod software on one server in a shared file system, while other servers only need to install the required dependencies and shell configuration files. However, you can also use this role to install Lmod on a single server.
This role also allows you to gradually switch from another module system to Lmod.
Table of Contents
Requirements
- Ansible 2.4
- cron for regular system spider cache updates
Role Variables
Base Variables
lmod_version: '7.7.14'
lmod_install: no
lmod_prefix: '/opt/apps'
lmod_module_root_path: '{{ lmod_prefix }}/modulefiles'
For HPC clusters: Set lmod_install
to yes
only for the server that installs Lmod globally. Other servers should install only the dependencies. Set this in host_vars
, see examples.
You can customize module file paths like this:
lmod_module_paths:
- '/software/modulefiles/compiler'
- '/software/modulefiles/libraries'
- '/software/modulefiles/tools'
Site Package
Modify the SitePackage.lua
:
lmod_site_package: path/to/my/templates/SitePackage.lua
System Spider Cache
Location for system spider cache files:
lmod_spider_cache_dir: '{{ lmod_module_root_path }}/.spider-cache'
lmod_spider_cache_stamp_file: '{{ lmod_module_root_path }}/.spider-cache.stamp'
Decide if you want to install the cron job to update the system spider cache:
lmod_spider_cache_cron: no
lmod_spider_cache_cron_minute: '0'
You can include additional paths when generating the system spider cache:
lmod_spider_cache_cron_modulepath:
- '$MODULEPATH'
Note: It might be helpful to add other paths for specific communities that have their own module directories.
For HPC clusters: Only needed on one server, similar to lmod_install
, see examples.
Shell Configuration
Set the names for shell configuration files to be saved in /etc/profile.d
:
lmod_init_bash_file: 'z00-lmod.sh'
lmod_init_csh_file: 'z00-lmod.csh'
Change these only if necessary for specific file sourcing order.
Incremental Roll-Out
This role supports incremental roll-out or canary release for transitioning from another module system to Lmod.
lmod_canary: no
This variable can take three values:
no
: Everyone uses Lmod.'opt-in'
: Lmod only initializes if an opt-in file exists.'opt-in-skel'
: Same as opt-in, but automatically applies to new users.'opt-out'
: Lmod doesn't initialize if an opt-out file exists.
Note: You can switch between these options, and the role will manage the transitions.
Expected file names for opt-in and opt-out:
lmod_canary_opt_in_file: '.lmod-yes'
lmod_canary_opt_out_file: '.lmod-no'
Note: Inform users to create these files to switch between options.
Administrative Messages
Optionally, you can show messages when certain modules are loaded:
lmod_admin_messages:
- pattern: gcc/2%.95
message: >-
This module is deprecated and will be removed. Please switch to a newer compiler.
- pattern: /opt/apps/modulefiles/Compiler/gcc/4.7.2/boost/1.55.0
message: We are having issues.
- pattern: boost/1%.[5-7].*
message: We are having more issues.
Dependencies
This role may require geerlingguy.repo-epel for RedHat distributions to install dependencies.
Example Playbook
Add to requirements.yml
:
---
# optional
# - src: geerlingguy.repo-epel
- src: idiv-biodiversity.lmod
Download with:
$ ansible-galaxy install -r requirements.yml
For HPC clusters: Some variables should be set for the main server in host_vars
, e.g. host_vars/head.yml
:
---
lmod_install: yes
lmod_spider_cache_cron: yes
Top-Level Playbook
Create a top-level playbook:
---
- name: head server
hosts: head
roles:
- role: idiv-biodiversity.lmod
tags:
- lmod
- modules
vars:
lmod_prefix: '/software'
lmod_install: yes
lmod_canary: 'opt-in'
Role Dependency
Define the role dependency in meta/main.yml
:
---
dependencies:
- role: idiv-biodiversity.lmod
vars:
lmod_prefix: '/software'
lmod_canary: 'opt-in'
tags:
- lmod
- modules
License
MIT
Author Information
Created in 2017 by Christian Krause, HPC cluster systems administrator at the German Centre for Integrative Biodiversity Research (iDiv). Additional support for Ubuntu was provided by [Tom Schoonjans][tschoonj].
install and set up "Lmod: A New Environment Module System"
ansible-galaxy install idiv_biodiversity.lmod