---
- name: install environment-modules
  yum: name=environment-modules state=installed
  sudo: true
  when: ansible_os_family == 'RedHat'

- name: install environment-modules
  apt: name=environment-modules state=installed
  sudo: true
  when: ansible_os_family == 'Debian'

- name: add /usr/local/Modules to the module file path
  lineinfile: 
  args:
    dest: /usr/share/Modules/init/.modulespath
    line: /usr/local/Modules/modulefiles
  ignore_errors: true
  sudo: true

# for some reason ubuntu uses lowercase modules
- name: add /usr/local/Modules to the module file path
  lineinfile: 
  args:
    dest: /usr/share/modules/init/.modulespath
    line: /usr/local/Modules/modulefiles
  ignore_errors: true
  sudo: true
