-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloud-init-master-node.yaml
57 lines (46 loc) · 1.45 KB
/
cloud-init-master-node.yaml
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
#cloud-config
package_update: true
package_upgrade: true
packages:
- docker.io
- curl
- make
- jq
- openssl
write_files:
- path: /etc/systemd/system/zaneops.service
content: |
[Unit]
Description=ZaneOps Deploy and Stop Service
After=docker.service
Wants=docker.service
[Service]
Type=oneshot
WorkingDirectory=/var/www/zaneops
ExecStart=/usr/bin/make deploy
ExecStop=/usr/bin/make stop
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
runcmd:
# Step 1: Start and enable Docker
- systemctl start docker
- systemctl enable docker
# Step 2: Create the installation directory for ZaneOps
- mkdir -p /var/www/zaneops
- cd /var/www/zaneops
# Step 3: Download the Makefile for the project
- curl https://raw.githubusercontent.com/zane-ops/zane-ops/main/deploy.mk > Makefile
# Step 4: Launch the setup process
- make setup
# Step 5: Get the IP address of the machine and format it
- IP_ADDRESS=$(ip route show default | awk '/src/ {for (i=1; i<=NF; i++) if ($i=="src") print $(i+1)}' | sed 's/\./-/g')
# Step 6: Replace '127-0-0-1' with the formatted IP in the .env file
- sed -i "s/127-0-0-1/$IP_ADDRESS/g" .env
# Step 8: Deploy ZaneOps
- make deploy
# Step 5: Enable and start the ZaneOps deploy service
- systemctl daemon-reload
- systemctl enable zaneops.service
- systemctl start zaneops.service
final_message: "ZaneOps installation completed."