---
- 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
  copy: src=files/slurmdbd.conf dest={{ slurm_dir }}/etc/slurmdbd.conf
  owner: slurm
  group: slurm
  mode: u+rw,g-wx,o-rwx
  sudo: true
  when: slurm_dir is defined


- name: install slurmdbd.conf
  copy: src=slurmdbd.conf dest=/etc/slurm/slurmdbd.conf
  mode: u+rw,g-wx,o-rwx
  owner: slurm
  group: slurm
  sudo: true
  when: slurm_dir is not defined

- name: add slurm db log rotate config
  template: src=slurmdblog.j2 dest=/etc/logrotate.d/slurmdb mode=644
  sudo: true

