-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-reservoir.yml
105 lines (90 loc) · 3 KB
/
deploy-reservoir.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
---
- name: Deploy Docker Swarm Stacks
hosts: sycorax
become: true
vars_files:
- secure.yml
- containers.yml
tasks:
- name: Copy compose directory to host
ansible.builtin.copy:
src: "files/reservoir"
dest: "/"
force: yes
- name: Copy memory limit script to host
ansible.builtin.copy:
src: "files/reservoir/make_user_mem_limit_files.py"
dest: "/"
owner: root
group: root
mode: 0700
- name: Install jsondiff
ansible.builtin.pip:
name: jsondiff
state: present
- name: Copy sshd config to host
ansible.builtin.copy:
src: "files/reservoir_host_keys"
dest: "/"
mode: 0700
- name: Create scripts directory on host
ansible.builtin.file:
path: "/root/scripts"
state: directory
mode: '0755'
- name: Copy scripts to host
ansible.builtin.copy:
src: "./scripts/{{ item }}"
dest: "/root/scripts"
mode: '0755'
loop:
- "install_container_toolkit.sh"
- name: Create symlink for libOpenCL
ansible.builtin.file:
src: "/usr/lib/x86_64-linux-gnu/libOpenCL.so.1"
dest: "/usr/lib/libOpenCL.so"
state: link
- name: Deploy Docker Swarm stack
community.docker.docker_stack:
state: present
name: "{{ inventory_hostname }}_stack"
compose:
- "/reservoir/docker-compose-{{ inventory_hostname }}.yml"
environment:
NGINX_HOSTNAME: "{{ inventory_hostname }}"
HOSTNAME: "{{ reservoir_hostname }}"
RESERVOIR_USER_PASSWORD: "{{ reservoir_user_password }}"
#CONTAINER_MEM_LIMIT: "{{ container_mem_limit }}"
controller_image: "{{ controller_image | default('ghcr.io/ecohealthalliance/slurm_reservoir:controller-gpu') }}"
worker_image: "{{ worker_image | default('ghcr.io/ecohealthalliance/slurm_reservoir:worker-gpu') }}"
- pause:
seconds: 40
- name: Ensure reservoir_host_keys directory has correct permissions
file:
path: /reservoir_host_keys
state: directory
mode: '700'
# Mounting the full ssh directory makes it so some things can't be updated in the base image, so
# instead a new directory is created and the configuration is updated to point to that.
# New tasks for SSH host keys and SSHD configuration
- hosts: docker_containers
become: yes
vars_files:
- secure.yml
- containers.yml
become_method: sudo
roles:
- update-accounts
tasks:
- name: Create gurobi dir
file: path=/opt/gurobi810 state=directory
- name: Create gurobi license
copy:
content: |
PASSWORD={{gurobi_password}}
TOKENSERVER=aegypti.ecohealthalliance.org
PORT=60954
dest: "/opt/gurobi810/gurobi.lic"
- name: Run script to create systemd memory limit files in each container
command: docker exec -it {{ item }} /make_user_mem_limit_files.py
loop: "{{ slurm_containers }}"