---
- name: install packages
  only_if: $is_centos
  action: yum pkg=$item state=latest
  with_items:
    - torque-mom

- name: Ensure pbs services are running
  only_if: $is_centos
  action: service name=$item state=started
  with_items:
    - pbs_mom

- name: Check pbs_mom config file is correct
  action: lineinfile dest=/var/spool/torque/mom_priv/config
          regexp='.*pbsserver.*'
          line='\$pbsserver ${groups.pbs_master[0]}'
  notify: restart pbs_mom

- name: Check pbs_mom usecp file
  action: lineinfile dest=/var/spool/torque/mom_priv/config
          regexp='.usecp .*'
          line='\$usecp *:/home /home'
