-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdadi.tftpl
47 lines (44 loc) · 1.72 KB
/
dadi.tftpl
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
#cloud-config
# Add groups to the system
# Adds the ubuntu group with members 'root' and 'sys'
# and the empty group hashicorp.
groups:
- ubuntu: [root,sys]
- dadi
# Add users to the system. Users are added after groups are added.
users:
- default
- name: dadi
gecos: dadi
shell: /bin/bash
primary_group: dadi
sudo: ALL=(ALL) NOPASSWD:ALL
groups: users, admin
lock_passwd: false
ssh_authorized_keys:
- ${public_key}
package_update: true
package_upgrade: true
runcmd:
# - systemctl stop sshd
- cd /home/dadi
- chown dadi:dadi .
- wget "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"
- su - dadi -c "bash Mambaforge-$(uname)-$(uname -m).sh -b"
- rm Mambaforge-$(uname)-$(uname -m).sh
- su - dadi -c 'echo "export CATALOG_UPDATE_PROTOCOL=tcp" >> /home/dadi/.profile'
- su - dadi -c 'echo ". /home/dadi/mambaforge/etc/profile.d/conda.sh" >> /home/dadi/.profile'
- su - dadi -c 'echo ". /home/dadi/mambaforge/etc/profile.d/mamba.sh" >> /home/dadi/.profile'
- su - dadi -c "git clone https://github.com/xin-huang/dadi-cli"
- su - dadi -c "mamba env create -f /home/dadi/dadi-cli/cloud-env.yml"
- su - dadi -c 'echo "conda activate dadi-cli" >> /home/dadi/.profile'
%{ if workqueue_password != "" }
- su - dadi -c 'echo "${workqueue_password}" > /home/dadi/wqpw'
%{ endif }
%{ if dadi_cli.run }
- su - dadi -c 'dadi-cli ${dadi_cli.parameters} %{ if dadi_cli.use_workqueue } --work-queue "${project_name}" /home/dadi/wqpw%{ endif } &'
%{ endif }
%{ if workqueue_factory.run }
- su - dadi -c 'work_queue_factory -T local -M "${project_name}" --password /home/dadi/wqpw -E "--connection-mode by_apparent_ip"'
%{ endif }
# - systemctl start sshd