-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloud-config
More file actions
118 lines (95 loc) · 4.34 KB
/
cloud-config
File metadata and controls
118 lines (95 loc) · 4.34 KB
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
116
117
118
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: multipart/mixed; boundary="=================exosphere-user-data===="
Number-Attachments: 4
--=================exosphere-user-data====
Content-Transfer-Encoding: 7bit
Content-Type: text/cloud-boothook
Content-Disposition: attachment; filename="00-exosphere-boothook.sh"
#!/bin/bash
# Ensure this hook only runs on the first boot.
if cloud-init-per instance exosphere-setup-starting /bin/false; then
exit 0
fi
echo on > /proc/sys/kernel/printk_devkmsg || true # Disable console rate limiting for distros that use kmsg
sleep 1 # Ensures that console log output from any previous command completes before the following command begins
echo '{"status":"starting", "epoch": '$(date '+%s')'000}' | tee --append /dev/console > /dev/kmsg || true
chmod 640 /var/log/cloud-init-output.log
--=================exosphere-user-data====
Content-Transfer-Encoding: 7bit
Content-Type: text/x-shellscript
Content-Disposition: attachment; filename="00-exosphere-setup-running.sh"
#!/bin/bash
sleep 1 # Ensures that console log output from any previous command completes before the following command begins
echo '{"status":"running", "epoch": '$(date '+%s')'000}' | tee --append /dev/console > /dev/kmsg || true
--=================exosphere-user-data====
Content-Transfer-Encoding: 7bit
Content-Type: text/x-shellscript
Content-Disposition: attachment; filename="90-exosphere-ansible-setup.sh"
#!/bin/bash
set +e
retry() {
local max_attempt=3
local attempt=0
while [ $attempt -lt $max_attempt ]; do
if "$@"; then
return 0
fi
echo "Command failed: $@"
attempt=$((attempt + 1))
if [ $attempt -lt $max_attempt ]; then
sleep 5
fi
done
echo "All retries of command failed: $@"
return 1
}
# {create-cluster-command}
(which apt-get && retry apt-get install -y python3-venv) # Install python3-venv on Debian-based platforms
(which yum && retry yum install -y python3) # Install python3 on RHEL-based platforms
python3 -m venv /opt/ansible-venv
. /opt/ansible-venv/bin/activate
retry pip install --upgrade pip
retry pip install ansible-core passlib
retry pip install lxml # required by community.general.xml
retry pip install psutil # required by community.general.pids
retry ansible-galaxy collection install community.general
rm -rf /opt/instance-config-mgt
# retry git clone \
# --depth=1 \
# --branch="{instance-config-mgt-repo-checkout}" \
# "{instance-config-mgt-repo-url}" \
# /opt/instance-config-mgt
retry git clone \
"https://github.com/MorphoCloud/exosphere.git" \
/opt/instance-config-mgt
exosphere_sha="db7e4abc263a779ece51df46c3672fdfb98e376d" # morpho-cloud-portal-2025.09.17-96cec41fb
(cd /opt/instance-config-mgt && git reset --hard $exosphere_sha)
ansible-playbook \
-i /opt/instance-config-mgt/ansible/hosts \
-e "{\"guac_enabled\":true,\"gui_enabled\":true,\"ansible_python_interpreter\":\"/opt/ansible-venv/bin/python\",\"instance_flavor\":\"INSTANCE_FLAVOR\"}" \
/opt/instance-config-mgt/ansible/playbook.yml
ANSIBLE_RETURN_CODE=$?
if [ $ANSIBLE_RETURN_CODE -eq 0 ]; then STATUS="complete"; else STATUS="error"; fi
sleep 1 # Ensures that console log output from any previous commands complete before the following command begins
echo '{"status":"'$STATUS'", "epoch": '$(date '+%s')'000}' | tee --append /dev/console > /dev/kmsg || true
--=================exosphere-user-data====
Content-Transfer-Encoding: 7bit
Content-Type: text/cloud-config
Content-Disposition: attachment; filename="exosphere.yml"
#cloud-config
users:
- default
- name: exouser
shell: /bin/bash
groups: sudo, admin
sudo: ['ALL=(ALL) NOPASSWD:ALL'] # {ssh-authorized-keys}
ssh-authorized-keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzSP8d9E0/iWqe/emHwYAiMF7EI9TTswoKRvKwP5qTe/djXL2kj0M+EfRf952D5agvnNXp4ldBDJwmvoZIs92Y+9GgAWBmkRwxH8e78p9rLlaZV4skGL1N+CIYi06eFHrQqn6h5qs0Dx710AAdL9jF6VZWvUnGvDDQ+/HnuKcNUtQT0S58tu0Cdn+LifX2WjesyjfxcUnjLpblz987Fiez7fmMGDnUDKqjdiwTAHyMVAff1QIvZ/pJeCfy0CcAgLkgeAaynmrVKIBjz6wyQk/5zV6Dum3/nkpZ/b6c+cou8UQeIDTiu9EPKLWSpz1UjgUxy9ZM009Vmqpw4f0WQaLXw== jchris.fillionr@kitware.com
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILpad9EojP42y5JAVyeiHI+zlKgb3FGmXFLfJMUwmzsE morpho-cloud-portal_github-runner
ssh_pwauth: true
package_update: true
package_upgrade: true # {install-os-updates}
# packages:
# - git{write-files}
--=================exosphere-user-data====--