File tree Expand file tree Collapse file tree 4 files changed +24
-4
lines changed
modules/nomad-server-aws/templates
modules/nomad-server-gcp/templates Expand file tree Collapse file tree 4 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,9 @@ echo 'export NOMAD_CLIENT_CERT=/etc/ssl/nomad/server.pem' >> /etc/environment
3030echo ' export NOMAD_CLIENT_KEY=/etc/ssl/nomad/key.pem' >> /etc/environment
3131echo " export NOMAD_ADDR=https://localhost:4646" >> /etc/environment
3232
33+ source /etc/environment
34+ env | grep " NOMAD_"
35+
3336echo " ----------------------------------------"
3437echo " Tuning kernel parameters"
3538echo " ----------------------------------------"
@@ -149,6 +152,7 @@ ExecStart=/usr/bin/nomad agent -config /etc/nomad/server.hcl
149152WantedBy=multi-user.target
150153EOT
151154
155+
152156echo " --------------------------------------"
153157echo " Starting Nomad service"
154158echo " --------------------------------------"
Original file line number Diff line number Diff line change @@ -26,7 +26,12 @@ echo "--------------------------------------"
2626echo ' export NOMAD_CACERT=/etc/ssl/nomad/ca.pem' >> /etc/environment
2727echo ' export NOMAD_CLIENT_CERT=/etc/ssl/nomad/client.pem' >> /etc/environment
2828echo ' export NOMAD_CLIENT_KEY=/etc/ssl/nomad/key.pem' >> /etc/environment
29- echo " export NOMAD_ADDR=https://localhost:4646" >> /etc/environment
29+
30+ [ " ${external_nomad_server} " == " true" ] && SCHEME=" https" || SCHEME=" http"
31+ echo " export NOMAD_ADDR=$SCHEME ://localhost:4646" >> /etc/environment
32+
33+ source /etc/environment
34+ env | grep " NOMAD_"
3035
3136retry () {
3237 local -r -i max_attempts=5
@@ -221,7 +226,7 @@ Description="nomad"
221226Environment="NOMAD_CACERT=/etc/ssl/nomad/ca.pem"
222227Environment="NOMAD_CLIENT_CERT=/etc/ssl/nomad/client.pem"
223228Environment="NOMAD_CLIENT_KEY=/etc/ssl/nomad/key.pem"
224- Environment="NOMAD_ADDR=https://localhost:4646 "
229+ Environment="NOMAD_ADDR=$NOMAD_ADDR "
225230Restart=always
226231RestartSec=30
227232TimeoutStartSec=1m
Original file line number Diff line number Diff line change @@ -80,6 +80,9 @@ configure_nomad() {
8080 echo ' export NOMAD_CLIENT_CERT=/etc/ssl/nomad/server.pem' >> /etc/environment
8181 echo ' export NOMAD_CLIENT_KEY=/etc/ssl/nomad/key.pem' >> /etc/environment
8282 echo " export NOMAD_ADDR=https://localhost:4646" >> /etc/environment
83+
84+ source /etc/environment
85+ env | grep " NOMAD_"
8386 # #########################################################################
8487
8588
@@ -134,6 +137,7 @@ configure_nomad() {
134137 EOT
135138 # #########################################################################
136139
140+ log " "
137141
138142
139143 log " -----------------------------------------"
@@ -161,6 +165,7 @@ configure_nomad() {
161165 log " -----------------------------------------"
162166
163167 log " "
168+
164169 log " Starting up nomad"
165170 systemctl enable --now nomad
166171}
Original file line number Diff line number Diff line change @@ -140,7 +140,12 @@ configure_nomad() {
140140 echo ' export NOMAD_CACERT=/etc/ssl/nomad/ca.pem' >> /etc/environment
141141 echo ' export NOMAD_CLIENT_CERT=/etc/ssl/nomad/client.pem' >> /etc/environment
142142 echo ' export NOMAD_CLIENT_KEY=/etc/ssl/nomad/key.pem' >> /etc/environment
143- echo " export NOMAD_ADDR=https://localhost:4646" >> /etc/environment
143+
144+ [ " ${external_nomad_server} " == " true" ] && SCHEME=" https" || SCHEME=" http"
145+ echo " export NOMAD_ADDR=$SCHEME ://localhost:4646" >> /etc/environment
146+
147+ source /etc/environment
148+ env | grep " NOMAD_"
144149
145150 log " Setting nomad configuration"
146151 mkdir -p /etc/nomad
@@ -215,6 +220,7 @@ configure_nomad() {
215220 fi
216221 ls -l /etc/nomad/client.hcl
217222
223+
218224 log " Writing nomad systemd unit"
219225 cat << -EOT > /etc/systemd/system/nomad.service
220226 [Unit]
@@ -223,7 +229,7 @@ configure_nomad() {
223229 Environment="NOMAD_CACERT=/etc/ssl/nomad/ca.pem"
224230 Environment="NOMAD_CLIENT_CERT=/etc/ssl/nomad/client.pem"
225231 Environment="NOMAD_CLIENT_KEY=/etc/ssl/nomad/key.pem"
226- Environment="NOMAD_ADDR=https://localhost:4646 "
232+ Environment="NOMAD_ADDR=$NOMAD_ADDR "
227233 Restart=always
228234 RestartSec=30
229235 TimeoutStartSec=1m
You can’t perform that action at this time.
0 commit comments