
- hosts: 'DesktopNodes,ComputeNodes,LoginNodes,VisNodes'
  gather_facts: True
  vars_files: 
  - vars/passwords.yml 
  - vars/names.yml
  - vars/ldapConfig.yml
  - vars/filesystems.yml 
  - vars/slurm.yml 
  - vars/vars.yml 
  tasks:
  - include_vars: vars/passwords.yml 
  - include_vars: vars/names.yml
  - include_vars: vars/ldapConfig.yml
  - include_vars: vars/filesystems.yml 
  - include_vars: vars/slurm.yml 
  - include_vars: vars/vars.yml 
  - { name: set use shared state, set_fact: usesharedstatedir=False }
  tags: [ always ]

- hosts: 'DesktopNodes,ComputeNodes,LoginNodes'
  gather_facts: False
  vars_files: 
  - vars/passwords.yml 
  - vars/names.yml
  - vars/ldapConfig.yml
  - vars/filesystems.yml 
  - vars/slurm.yml 
  - vars/vars.yml 
  strategy: free
  roles:
  - { role: move_homedir, tags: [ authentication, filesystems ] }
  - { role: nfs-client, nfsMounts: "{{ computeNfsMounts }}", tags: [ filesystems ] }
  - { role: slurm-common, tags: [ slurm, slurm-common ] }
  #- { role: lmod, tags: [ other ] } # actually preffered on ubuntu but mutually exclusive with environment-modules
  - { role: enable_modules, default_modules: "modulecmd", tags: [ other ] }
  - { role: postfix, tags: [ mail, other ] }
  - { role: set_semaphore_count, tags: [ semaphore ] }
  - { role: ldapclient, ssl: false, tags: [ ldapclient ] }
  - { role: pam_sshd, computenodepam: true, tags: [ authentication, pamd ] }
  - { role: ssh-keepalive, tags: [ ssh ] }
  - { role: enable_sudo_group, tags: [ authentication ] }

- hosts: 'VisNodes'
  gather_facts: False
  vars_files:
  - vars/vars.yml
  roles:
  - { role: gpu, tags: [ gpu ] }

- hosts: 'DesktopNodes,ComputeNodes,LoginNodes'
  gather_facts: False
  vars_files:
  - vars/passwords.yml
  - vars/names.yml
  - vars/ldapConfig.yml
  - vars/filesystems.yml
  - vars/slurm.yml
  - vars/vars.yml
  roles:
  - { role: slurm_config, tags: [slurm, slurm_config] }

- hosts: 'DesktopNodes,ComputeNodes'
  gather_facts: False
  vars_files:
  - vars/passwords.yml
  - vars/names.yml
  - vars/ldapConfig.yml
  - vars/filesystems.yml
  - vars/slurm.yml
  - vars/vars.yml
  strategy: free
  roles:
  - { role: slurm-start, start_slurmd: True, tags: [ slurm, slurmstart ] }
  #- { role: mate-de-install, tags: [ mate-de-install ] }   # TODO this crashes for everything except cmca

- hosts: 'K1Nodes'
  tasks:
  - { name: set nvidia driver version, set_fact: nvidia_version='367.130' }
  tags: [ always ]

- hosts: 'VisNodes'
  tasks:
  - { name: set cuda monitoring, set_fact: cudamonitor=true }
  tags: [ always ]

- hosts: 'ComputeNodes'
  vars_files:
  - vars/slurm.yml
  roles:
  - { role: slurm-common, tags: [ slurm, slurmbuild ] }
  - { role: slurm_config, tags: [ slurm_config, slurm ] }
  - { role: calculateNhcConfig, tags: [ nhc, slurm ] }
  - { role: nhc, tags: [ nhc, slurm ] }
  - { role: slurm-start, start_slurmd: True, tags: [ slurm, slurm-start ] }
  - { role: vncserver, tags: [ other ] }
  - { role: jasons_ssh_ca, tags: [ other ] }
  - { role: lmod, tags: [ other ] }
  #- { role: extra_packages, tags: [ other, extra_packages ] } # commented because it takes forever! good enough if this gets tested on clusterbuild
  - { role: enable_modules, default_modules: "modulecmd", tags: [ other ] }
  - { role: postfix, tags: [ mail, other ] }
  - { role: set_semaphore_count, tags: [ semaphore ] }
  - { role: telegraf, telegraf_install_rpm_url: 'http://consistency0/src/telegraf-1.12.6-1.x86_64.rpm', tags: [ monitoring,SiteSpecific ] }

- hosts: 'VisNodes'
  roles:
  - { role: systemd-nvidia-uvm, tags: [ uvm,SiteSpecific ] }

- hosts: 'VisNodes'
  roles:
  - { role: deploy-xorg, tags: [ deploy-xorg ] }