Skip to content

Instantly share code, notes, and snippets.

@raonyguimaraes
Last active June 25, 2018 17:19
Show Gist options
  • Save raonyguimaraes/e70220921504d26a0627050ade17bc24 to your computer and use it in GitHub Desktop.
Save raonyguimaraes/e70220921504d26a0627050ade17bc24 to your computer and use it in GitHub Desktop.
GCC BOSC 2018
#!/bin/bash
sudo pip install ansible
git clone https://github.com/ARTbio/GalaxyKickStart
cd GalaxyKickStart
git checkout 2018-gccbosc
ansible-galaxy install -r requirements_roles.yml -p roles --force
cat <<EOT >> group_vars/gccbosc18.yml
galaxy_root_dir: /srv/galaxy
galaxy_server_dir: "{{ galaxy_root_dir }}/server"
galaxy_venv_dir: "{{ galaxy_root_dir }}/venv"
galaxy_mutable_data_dir: "{{ galaxy_data }}"
proftpd_files_dir: "{{ galaxy_data }}/ftp"
galaxy_config_dir: "{{ galaxy_root_dir }}/config"
galaxy_mutable_config_dir: "{{ galaxy_config_dir }}"
galaxy_shed_tools_dir: "{{ galaxy_root_dir }}/shed_tools"
galaxy_tool_dependency_dir: "{{ galaxy_root_dir }}/dependencies"
tool_dependency_dir: "{{ galaxy_tool_dependency_dir }}"
galaxy_job_conf_path: "{{ galaxy_config_dir }}/job_conf.xml"
galaxy_job_metrics_conf_path: "{{ galaxy_config_dir }}/job_metrics_conf.xml"
nginx_upload_store_path: "{{ galaxy_data }}/upload_store"
tool_data_table_config_path: "{{ galaxy_config_dir }}/tool_data_table_conf.xml,/cvmfs/data.galaxyproject.org/managed/location/tool_data_table_conf.xml"
len_file_path: "{{ galaxy_config_dir }}/len"
galaxy_log_dir: "{{ galaxy_root_dir }}/log"
supervisor_slurm_config_dir: "{{ galaxy_log_dir }}"
galaxy_manage_trackster: False
galaxy_extras_config_cvmfs: True
galaxy_restart_handler_enabled: True
galaxy_mule_handlers: True
galaxy_handler_processes: 1
galaxy_config_style: yaml
galaxy_config_file: "{{ galaxy_config_dir }}/galaxy.yml"
galaxy_config:
galaxy:
database_connection: "{{ galaxy_db }}"
file_path: "{{ galaxy_data }}/datasets"
new_file_path: "{{ galaxy_data }}/tmp"
galaxy_data_manager_data_path: "{{ galaxy_data }}/tool-data"
job_config_file: "{{ galaxy_job_conf_path }}"
ftp_upload_dir: "{{ proftpd_files_dir }}"
ftp_upload_site: ftp://[server IP address]
tool_data_table_config_path: "{{ tool_data_table_config_path }}"
len_file_path: "{{ len_file_path }}"
check_migrate_tools: False
uwsgi:
module: galaxy.webapps.galaxy.buildapp:uwsgi_app()
logfile-chmod: 644
additional_files_list:
- { src: "extra-files/galaxy-kickstart/logo.png", dest: "{{ galaxy_server_dir }}/static/images/" }
- { src: "extra-files/tool_sheds_conf.xml", dest: "{{ galaxy_config_dir }}" }
- { src: "extra-files/cloud_setup/vimrc", dest: "/etc/vim/" }
EOT
cat <<EOT >> inventory
[gccbosc18]
localhost ansible_connection=local
EOT
cat <<EOT >> galaxy.yml
- hosts: all
become: yes
gather_facts: False
environment: "{{ proxy_env }}"
handlers:
- include: roles/handlers/galaxy.yml
static: yes
pre_tasks:
- fail: msg="Installed ansible version {{ ansible_version.full }}, but ansible version later than 2.1 required"
when: "{{ ansible_version.full | version_compare('2.1.0.0', '<') }}"
tags:
- always
- raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
tags:
- always
- setup: # aka gather_facts
tags:
- always
- set_fact:
banner_img: "{% if 'jetstream' in group_names %}jetstream_text.png{% else %}gce_text.png{% endif %}"
- name: Create galaxy system user
user:
name: "galaxy"
home: "/srv/galaxy"
skeleton: "/etc/skel"
shell: "/bin/bash"
system: yes
tags:
- always
roles:
- role: galaxyprojectdotorg.galaxy-os
tags:
- install_galaxy
- install_packages
- role: cloud_setup
when: cloud_setup is defined
- role: ensure_postgresql_up
tags:
- install_galaxy
- manage_postgres
- role: natefoo.postgresql_objects
postgresql_objects_users:
- name: "{{ galaxy_user_name }}"
password: "{{ galaxy_user_name }}"
encrypted: "yes"
postgresql_objects_databases:
- name: "{{ galaxy_user_name }}"
owner: "{{ galaxy_user_name }}"
become: yes
become_user: postgres
tags:
- install_galaxy
- manage_postgres
- role: miniconda-role
tags: conda
become: yes
become_user: "{{ galaxy_user_name }}"
- role: galaxyprojectdotorg.galaxy
become: yes
become_user: "{{ galaxy_user_name }}"
tags:
- configure_galaxy
- install_galaxy
- role: set_supervisor_env_vars
tags: env_vars
- role: copy_additional_files
tags:
- install_extras
# Installs supervisor, nginx and proftpd
- role: galaxyprojectdotorg.galaxy-extras
tags:
- configure_server_stack
- install_extras
- role: ensure_postgresql_up
tags:
- manage_postgres
- install_tools
- role: galaxy.movedata
tags:
- persists_galaxy
- role: galaxyprojectdotorg.trackster
tags: configure_galaxy
- role: galaxyprojectdotorg.galaxy-tools
become: yes
become_user: "{{ galaxy_user_name }}"
tags: install_tools
- role: run_data_manager_role
tags:
- install_data_managers
when: gks_run_data_managers
post_tasks:
- name: Clean apt cache to recover some disk space
shell: apt-get clean
# htop is a placeholder here; see bug report
# https://github.com/ansible/ansible-modules-core/issues/4029
- name: Apt autoremove
apt: autoremove=yes name=htop
EOT
ansible-playbook -i inventory galaxy.yml --tags "install_galaxy,install_extras"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment