File tree Expand file tree Collapse file tree 2 files changed +25
-12
lines changed Expand file tree Collapse file tree 2 files changed +25
-12
lines changed Original file line number Diff line number Diff line change @@ -105,16 +105,7 @@ resource "null_resource" "setup" {
105
105
106
106
provisioner "remote-exec" {
107
107
inline = [
108
- " echo '===== running setup.sh ====='" ,
109
- " chmod +x /tmp/setup.sh && /tmp/setup.sh" ,
110
- " echo '===== extracting compose tarball ====='" ,
111
- " tar -vxz -f /root/compose.tar.gz -C /root/sandbox" ,
112
- " echo '===== setting up docker-compose .env overrides ====='" ,
113
- " echo TINKERBELL_CLIENT_MAC=${ local . worker_macs [0 ]} >>/root/sandbox/compose/.env" ,
114
- " echo TINKERBELL_TEMPLATE_MANIFEST=/manifests/template/ubuntu-equinix-metal.yaml >>/root/sandbox/compose/.env" ,
115
- " echo TINKERBELL_HARDWARE_MANIFEST=/manifests/hardware/hardware-equinix-metal.json >>/root/sandbox/compose/.env" ,
116
- " echo '===== bringing up docker-compose stack ====='" ,
117
- " docker-compose -f /root/sandbox/compose/docker-compose.yml up -d"
108
+ " chmod +x /tmp/setup.sh && /tmp/setup.sh ${ local . worker_macs [0 ]} " ,
118
109
]
119
110
}
120
111
}
Original file line number Diff line number Diff line change @@ -108,19 +108,41 @@ make_host_gw_server() {
108
108
systemctl start docker
109
109
}
110
110
111
+ extract_compose_files () {
112
+ mkdir -p /root/sandbox
113
+ tar -zxvf /root/compose.tar.gz -C /root/sandbox
114
+ }
115
+
116
+ setup_compose_env_overrides () {
117
+ local worker_mac=$1
118
+ readarray lines << -EOF
119
+ TINKERBELL_CLIENT_MAC=$worker_mac
120
+ TINKERBELL_TEMPLATE_MANIFEST=/manifests/template/ubuntu-equinix-metal.yaml
121
+ TINKERBELL_HARDWARE_MANIFEST=/manifests/hardware/hardware-equinix-metal.json
122
+ EOF
123
+ for line in " ${lines[@]} " ; do
124
+ grep -q " $line " /root/sandbox/compose/.env && continue
125
+ echo " $line " >> /root/sandbox/compose/.env
126
+ done
127
+ }
128
+
111
129
main () {
130
+ worker_mac=$1
131
+ layer2_ip=192.168.56.4
132
+
112
133
update_apt
113
134
install_docker
114
135
install_docker_compose
115
136
install_iptables_persistent
116
137
117
- local layer2_ip=192.168.56.4
118
138
local layer2_interface
119
139
layer2_interface=$( get_second_interface_from_bond0 ${layer2_ip} )
120
140
setup_layer2_network " ${layer2_interface} " ${layer2_ip}
121
141
make_host_gw_server " ${layer2_interface} " bond0
122
142
123
- mkdir -p /root/sandbox/compose
143
+ extract_compose_files
144
+ setup_compose_env_overrides " $worker_mac "
145
+ docker-compose -f /root/sandbox/compose/docker-compose.yml up -d
124
146
}
125
147
126
148
if [[ ${BASH_SOURCE[0]} == " $0 " ]]; then
You can’t perform that action at this time.
0 commit comments