---
- hosts: galaxydev.sanbi.ac.za
  vars:
  - admin_ssh_key: "{{ lookup('file', '/home/pvh/.ssh/id_rsa.pub') }}"
  - hostname: galaxydev.sanbi.ac.za
  - ldap_base: dc=sanbi,dc=ac,dc=za
  - ldap_uri: ldap://ldap.sanbi.ac.za
  - ldap_filter: active=TRUE
  - kerberos_realm: SANBI
  - kerberos_server: auth.sanbi.ac.za
  - automount_links:
      cip0:
       { src: "/net/datasrv3hs.sanbi.ac.za/datastore/cip0", dest: "/cip0" }
      people:
        { src: "/net/datasrv3hs.sanbi.ac.za/datastore/data12/people", dest: "/usr/people" }
  - galaxy_server_dir: /cip0/software/galaxy/galaxydev/galaxy
  - galaxy_config_dir: "{{ galaxy_server_dir }}/config"
  - galaxy_mutable_config_dir: "{{ galaxy_server_dir }}/config"
  - galaxy_home_dir: "{{ galaxy_server_dir }}"
  - galaxy_venv_dir: "{{ galaxy_server_dir }}/.venv"
  - galaxy_root: "{{ galaxy_server_dir }}"
  - galaxy_vcs: git
  - galaxy_changeset_id: dev
  - galaxy_user_name: galaxy
  - galaxy_user_uid: 1097
  - galaxy_user_gid: 1047
  - galaxy_handler_env: "SGE_ROOT=/var/lib/gridengine"
  - galaxy_slurm_drm: false # we use SGE, not SLURM
  - postgresql_objects_users:
      - name: galaxy
        password: null
  - postgresql_objects_databases:
      - name: galaxy
        owner: galaxy
  - galaxy_config:
      "app:main":
        database_connection: "postgresql:///galaxy?host=/var/run/postgresql"
        admin_users: pvh@sanbi.ac.za,zipho@sanbi.ac.za
      "uwsgi":
        stats: 127.0.0.1:9191
        socket: 127.0.0.1:4001
        pythonpath: lib
        master: True
      "server:handler0":
        use: egg:Paste#http
        port: 8090
        host: 127.0.0.1
        use_threadpool: true
        threadpool_workers: 5        
      "server:handler1":
        use: egg:Paste#http
        port: 8091
        host: 127.0.0.1
        use_threadpool: true
        threadpool_workers: 5        

  - galaxy_extras_config_nginx: true
  - galaxy_extras_config_proftpd: false
  - galaxy_extras_config_slurm: false
  - galaxy_extras_config_supervisor: true
  - galaxy_extras_config_galaxy_root: false
  - galaxy_extras_config_galaxy_job_metrics: false
  - galaxy_extras_config_uwsgi: true
  - galaxy_extras_config_ie_proxy: false
  - galaxy_extras_config_scripts: true
  - galaxy_extras_config_startup: false
  - supervisor_manage_slurm: false
  - supervisor_manage_proftp: false
  - supervisor_manage_ie_proxy: false
  - supervisor_postgres_options: "-D /etc/postgresql/9.3/main"
  - galaxy_uwsgi_static_conf: true # set number of threads and processes statically in supervisor config
  - nginx_ssl: true
  - nginx_ssl_cert_file: /home/pvh/Documents/SANBI/Certs/sanbi.pem
  - nginx_ssl_key_file: /home/pvh/Documents/SANBI/Certs/sanbi.key

  roles:
  - { role: basic-server, tags: basic-server }
  - { role: ansible-galaxy-os, tags: ansible-galaxy-os }
  - { role: ansible-postgresql-objects, become: yes, become_user: postgres, tags: galaxy }
  - { role: ansible-galaxy, tags: galaxy, become: yes, become_user: "{{ galaxy_user_name | default('galaxy') }}" }
  - { role: ansible-galaxy-extras, tags: galaxy }
  - { role: ansible-galaxy-pam-auth-sanbi, tags: galaxy }
  - { role: ansible-galaxy-envmodules-sanbi, tags: galaxy } 
  - { role: ansible-galaxy-sge-sanbi, tags: galaxy }
