---

- name: template lmod bash
  template: src=lmod.sh.j2 dest=/etc/profile.d/lmod.sh 
  become: true
  become_user: root
  when: default_modules == "lmod"

- name: template lmod csh
  template: src=lmod.csh.j2 dest=/etc/profile.d/lmod.csh
  become: true
  become_user: root
  when: default_modules == "lmod"

- name: remove modulecmd bash
  file: path=/etc/profile.d/zz_modulecmd.sh state=absent
  become: true
  become_user: root
  when: default_modules == "lmod"

- name: remove modulcmd csh
  file: path=/etc/profile.d/zz_modulecmd.csh state=absent
  become: true
  become_user: root
  when: default_modules == "lmod"

- name: template modulecmd bash
  template: src=modulecmd.sh.j2 dest=/etc/profile.d/modulecmd.sh
  become: true
  become_user: root
  when: default_modules == "modulecmd"

- name: template patchmodulecmd bash
  template: src=patchmodulecmd.sh.j2 dest=/etc/profile.d/patchmodulecmd.sh.j2
  become: true
  become_user: root
  when: default_modules == "modulecmd"

- name: template modulecmd csh
  template: src=modulecmd.csh.j2 dest=/etc/profile.d/modulecmd.csh
  become: true
  become_user: root
  when: default_modules == "modulecmd"

- name: remove lmod bash
  file: path=/etc/profile.d/lmod.sh state=absent
  become: true
  become_user: root
  when: default_modules == "modulecmd"

- name: remove modulcmd csh
  file: path=/etc/profile.d/lmod.csh state=absent
  become: true
  become_user: root
  when: default_modules == "modulecmd"
