-
Notifications
You must be signed in to change notification settings - Fork 3
/
galaxysrv.yml
115 lines (95 loc) · 3.58 KB
/
galaxysrv.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
- name: Install Galaxy Server
hosts: "{{ lookup('env', 'variable_host') | default('localhost', true) }}" # workaround because SRC needs localhost, but molecule needs specifc hostvars
pre_tasks:
- name: Set workspace user facts
ansible.builtin.include_role:
name: uusrc.general.fact_regular_users
- name: Include config tasks and load variables
ansible.builtin.include_tasks: tasks/set_config.yml
- name: Install Dependencies
ansible.builtin.apt:
update_cache: true
name:
- 'git'
- 'python3-psycopg2'
- 'python3-virtualenv'
- 'python3-dev'
- 'gcc'
- 'acl'
- 'gnutls-bin' # workaround for git-clone issue, https://stackoverflow.com/a/53147659/4326632
state: present
- name: Additional nginx config
ansible.builtin.include_tasks: tasks/nginx.yml
roles:
- role: geerlingguy.docker
when: not _molecule_active and _galaxy_enable_docker
- role: uusrc.general.nginx_reverse_proxy
vars:
nginx_reverse_proxy_locations: "{{ galaxy_nginx_vhost_config }}"
- role: galaxyproject.postgresql
- role: galaxyproject.postgresql_objects
become: true
become_user: postgres
- role: galaxyproject.galaxy
vars:
galaxy_config: "{{ _galaxy_config }}"
tasks:
- name: Copy default tool config
tags: molecule-idempotence-notest
ansible.builtin.copy:
remote_src: true
src: "{{ galaxy_server_dir }}/config/tool_conf.xml.sample"
dest: "{{ galaxy_config_dir }}/tool_conf.xml"
owner: "{{ galaxy_privsep_user }}"
group: "{{ galaxy_user }}"
mode: "644"
- name: Enable interactive tools
ansible.builtin.include_tasks: tasks/interactive_tools.yml
when: _galaxy_use_interactive_tools
- name: Add nginx user to galaxy group
ansible.builtin.user:
name: www-data
groups: "{{ galaxy_user }}"
append: true
notify: restart nginx
- name: Create welcome page
ansible.builtin.template:
src: welcome.html.j2
dest: "{{ galaxy_server_dir }}/static/welcome.html"
owner: "{{ galaxy_privsep_user }}"
group: "{{ galaxy_user }}"
mode: "644"
- name: Populate service facts
ansible.builtin.service_facts:
- name: Enable the server and bootstrap
when: "ansible_facts.services['galaxy-gunicorn.service'] is not defined or ansible_facts.services['galaxy-gunicorn.service']['state'] != 'running' or _galaxy_do_bootstrap"
block:
- name: Galaxy gravity graceful
command: "/usr/local/bin/galaxyctl graceful"
- name: Enable galaxy service
ansible.builtin.systemd_service:
name: galaxy.target
enabled: true
state: started
- name: Include tasks to bootstrap the instance
when: _galaxy_do_bootstrap
ansible.builtin.include_tasks: tasks/bootstrap.yml
always:
- name: Remove bootstrap API key from Galaxy config
when: _galaxy_bootstrap_api_key is defined
ansible.builtin.lineinfile:
path: "{{ galaxy_config_dir }}/galaxy.yml"
regexp: '.*bootstrap_admin_api_key:'
state: absent
notify: galaxy gravity restart
handlers:
- name: Restart nginx
ansible.builtin.service:
name: nginx
state: restarted
listen: restart nginx
- name: Galaxy gravity restart
command: "/usr/local/bin/galaxyctl graceful"
listen: "restart galaxy"
when: _galaxy_already_started is not defined