Compare commits

...

3 Commits

Author SHA1 Message Date
Starbeamrainbowlabs 8220c62233
comment ask_* functions properly
continuous-integration/laminar-eldarion Build failed with exit code 123 after 3 seconds Details
Ref 
https://starbeamrainbowlabs.com/blog/article.php?article=posts/499-whiptail.html
2022-04-30 15:03:51 +01:00
Starbeamrainbowlabs 7e47d23a28
consul: add postinstall step 2022-04-30 15:03:28 +01:00
Starbeamrainbowlabs ea8365f4ee
poostinstall:nfs: chmod +x 2022-04-30 15:03:13 +01:00
5 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,17 @@
bind_addr = "{{ GetInterfaceIP \"wgoverlay\" }}"
bootstrap = false
server = false
domain = "mooncarrot.space."
client_addr = "127.0.0.1 {{ GetInterfaceIP \"docker0\" }}"
data_dir = "/srv/consul"
log_level = "INFO"
retry_join = [
"wopplefox",
"spatterling",
"sycadil"
]

View File

@ -0,0 +1,24 @@
bind_addr = "{{ GetInterfaceIP \"wgoverlay\" }}"
# When we have this many servers in the cluster, automatically run the first leadership election
# Remember that the Hashicorp stack uses the Raft consensus algorithm.
bootstrap_expect = 3
server = true
ui_config {
enabled = true
}
client_addr = "127.0.0.1 {{ GetInterfaceIP \"docker0\" }} {{ GetInterfaceIP \"wgoverlay\" }}"
data_dir = "/srv/consul"
log_level = "INFO"
domain = "mooncarrot.space."
retry_join = [
// "172.16.230.100"
"wopplefox",
"spatterling",
"sycadil"
]

View File

@ -46,12 +46,20 @@ fi
###############################################################################
# Asks the user a yes/no question.
# $1 The question to ask the user.
# Returns 0 if the answer was yes, or 1 if the answer was no.
ask_yesno() {
local question="$1";
whiptail --title "Step ${step_current} / ${step_max}" --yesno "${question}" 40 8;
return "$?"; # Not actually needed, but best to be explicit
}
# Asks the user for a string of text.
# $1 The window title.
# $2 The question to ask.
# $3 The default text value.
# Returns the answer as a string on the standard output.
ask_text() {
local title="$1";
local question="$2";
@ -59,6 +67,12 @@ ask_text() {
whiptail --title "${title}" --inputbox "${question}" 10 40 "${default_text}" 3>&1 1>&2 2>&3;
return "$?"; # Not actually needed, but best to be explicit
}
# Asks the user for a password.
# $1 The window title.
# $2 The question to ask.
# $3 The default text value.
# Returns the answer as a string on the standard output.
ask_password() {
local title="$1";
local question="$2";
@ -66,6 +80,10 @@ ask_password() {
whiptail --title "${title}" --passwordbox "${question}" 10 40 "${default_text}" 3>&1 1>&2 2>&3;
return "$?"; # Not actually needed, but best to be explicit
}
# Asks the user to choose at most 1 item from a list of items.
# $1 The window title.
# $2..$n The items that the user must choose between.
# Returns the chosen item as a string on the standard output.
ask_multichoice() {
local title="$1"; shift;
local args=();

0
src/steps-postinstall/20-nfs.sh Normal file → Executable file
View File

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
task_begin "Installing Consul configuration";
# /etc/consul is created by the apt postinstall script
subtask_begin "Copying configuration files";
cp "configs/consul-client.hcl" "/etc/consul/client.hcl";
cp "configs/consul-server.hcl" "/etc/consul/server.hcl";
subtask_end "$?";
subtask_begin "Starting Consul and enabling on boot";
systemctl consul;
subtask_end "$?";
task_end "$?";