---
- name: install deps in control node
  yum: name={{ item }} state=installed
  sudo: true
  with_items:
    - mysql
    - mysql-devel
    - MySQL-python
  when: ansible_os_family == "RedHat"

- name: install deps in control node
  apt: name={{ item }} state=installed
  sudo: true
  with_items:
    - mysql-client
    - libmysqlclient-dev
    - python-mysqldb
  when: ansible_os_family == "Debian"

- name: make sure config dir exists
  file: path="{{ slurm_dir }}/etc" state=directory
  sudo: true

- name: install slurmdb.conf
  template: src=slurmdbd.conf.j2 dest={{ slurm_dir }}/etc/slurmdbd.conf
  sudo: true
  when: slurm_dir is defined


- name: install slurmdbd.conf
  template: src=slurmdbd.conf.j2 dest=/etc/slurm/slurmdbd.conf
  sudo: true
  when: slurm_dir is not defined

