mirror of
https://github.com/Cian-H/I-Form_Server_Node_Deployer.git
synced 2025-12-23 14:42:02 +00:00
First commit
This commit is contained in:
42
templates/fuel-ignition.json
Normal file
42
templates/fuel-ignition.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"login": {
|
||||
"users": [
|
||||
{
|
||||
"name": "root",
|
||||
"hash_type": "bcrypt"
|
||||
}
|
||||
]
|
||||
},
|
||||
"network": {
|
||||
"interfaces": [
|
||||
{
|
||||
"name": "eth0",
|
||||
"ipv4": {
|
||||
"network_type": "DHCP",
|
||||
"auto_dns_enabled": true
|
||||
},
|
||||
"ipv6": {
|
||||
"network_type": "DHCP",
|
||||
"auto_dns_enabled": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"systemd": {
|
||||
"units": [
|
||||
{
|
||||
"name": "cockpit.socket.service",
|
||||
"enabled": "yes"
|
||||
},
|
||||
{
|
||||
"name": "docker.service",
|
||||
"enabled": "yes"
|
||||
}
|
||||
]
|
||||
},
|
||||
"package": {
|
||||
"install": [
|
||||
"patterns-microos-cockpit, docker, jq"
|
||||
]
|
||||
}
|
||||
}
|
||||
8
templates/join_swarm.service
Normal file
8
templates/join_swarm.service
Normal file
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Ensure that node joins a swarm on startup
|
||||
|
||||
[Service]
|
||||
ExecStart=/root/join_swarm.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
16
templates/join_swarm.sh
Normal file
16
templates/join_swarm.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "This script must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Load the config file into variables
|
||||
eval "$(jq -r 'to_entries[] | "export \(.key)=\(.value | @sh)"' /root/join_swarm.json)"
|
||||
|
||||
if [[ $(docker info | grep Swarm | awk '{print $2}') == "inactive" ]]; then
|
||||
docker swarm join --token $SWARM_TOKEN [$SWITCH_IP_ADDRESS]:$SWITCH_PORT
|
||||
else
|
||||
echo "This node is already part of a swarm"
|
||||
docker info -f json | jq .Swarm
|
||||
fi
|
||||
Reference in New Issue
Block a user