---
- include_vars: "{{ ansible_os_family }}.yml"

- name: Install epel-release 
  yum: name=epel-release-7-5.noarch state=present 
  sudo: true 
  when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"

- name: Enable epel 
  command: yum-config-manager --enable epel 
  sudo: true
  when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"

- name: install lua
  yum: name={{ item }} state=installed
  with_items:
    - lua
    - lua-filesystem
    - lua-posix
  sudo: true
  when: ansible_os_family == 'RedHat'

- name: install lua
  apt: name={{ item }} state=installed
  with_items:
    - lua5.2
    - lua5.2
    - lua-filesystem
    - lua-bitop
    - lua-posix
    - liblua5.2-0
    - liblua5.2-dev
    - tcl
  sudo: true
  when: ansible_os_family == 'Debian'

- name: link bash
  file: src={{ soft_dir }}/lmod/lmod/init/bash dest=/etc/profile.d/lmod.sh state=link
  sudo: true

- name: link csh
  file: src={{ soft_dir }}/lmod/lmod/init/cshrc dest=/etc/profile.d/lmod.csh state=link
  sudo: true
