---
- name: Install TORQUE packages
  when: is_centos
  action: yum pkg={{item}} state=latest
  with_items:
    - torque-server

- name: Update node file
  action: template src=pbs+maui/templates/var/spool/torque/server_priv/nodes.j2
          dest=/var/spool/torque/server_priv/nodes
  notify:
    - restart pbs_server

- name: Fix for checkpoint directory not found
  action: file path=/var/spool/torque/checkpoint state=directory

- name: fix /var/spool/torque/server_name
  action: template src=pbs+maui/templates/var/spool/torque/server_name.j2
          dest=/var/spool/torque/server_name
  notify: 
    - restart pbs_server

- name: Ensure pbs services are running
  when: is_centos
  action: service name={{item}} state=started
  with_items:
    - trqauthd
    - pbs_server

- name: copy default configuration file for pbs
  action: copy src=pbs+maui/files/qmgr.bootstrap dest=/var/spool/torque/server_priv/qmgr.bootstrap

- name: default configuration
  action: shell qmgr < /var/spool/torque/server_priv/qmgr.bootstrap

