]> WPIA git - infra.git/commitdiff
upd: cleanup inclusion of config and document config elements
authorFelix Dörre <felix@dogcraft.de>
Sun, 16 Jul 2017 17:06:16 +0000 (19:06 +0200)
committerLucas Werkmeister <mail@lucaswerkmeister.de>
Sun, 16 Jul 2017 20:56:53 +0000 (22:56 +0200)
Change-Id: I8ee625b6e8ad85ae68c75875d07f9bd829de442a

manager/config [new file with mode: 0755]
manager/fetch
manager/installNRE
manager/setup

diff --git a/manager/config b/manager/config
new file mode 100755 (executable)
index 0000000..6625d0d
--- /dev/null
@@ -0,0 +1,66 @@
+### Documentation for configuration options
+
+## Variables
+
+# (required) Base domain for infra system installation.
+#to=
+
+# (required) Hostname or IP address of the infra system.
+#domain=
+
+# Additional packages that should be installed.
+devPkgs=""
+
+# How to connect to the signer backend.
+#
+# Either the name for the serial device or "self" to indicate that a signer container should be set up.
+signerLocation=self
+
+## Functions
+
+# Run a command in the infra system, accepting additional ssh-options.
+function ssh_target {
+    ssh -i vm-key "$to" "$@"
+}
+
+# Install nre-files to the target system.
+#
+# * Extract all "signer-server" to modules/cassiopeia_signer/files in the target system.
+# * Extract all "signer-client" to modules/cassiopeia_client/files in the target system.
+# * Extract all "gigi" to modules/ner/files in the target system.
+function install_nre {
+    ./installNRE "$targetHost"
+}
+
+# Configure variables for puppet.
+#
+# The default implementation prompts the user for all required variables.
+function configure {
+    ssh_target -t 'bash conf-puppet --force'
+    ssh_target 'sed -i "s%\$signerLocation = '".*'"'%\$signerLocation = '"'$signerLocation'"'%" environments/production/manifests/ip.pp'
+}
+
+# Reset a vm to its base snapshot.
+#
+# The default implementation asks the user to do so.
+function do_reset_vm {
+    read -rp "Please reset your VM and confirm by pressing enter." _
+}
+
+# Execute the gigi bootstrapping process. By default the process interacts with the user.
+#
+# This function can be overridden to execute "execute-bootstrap-user-auto" in order to automate this bootstrapping process.
+# Make sure to provide "bootstrapper_details" to provide the necessary answers.
+# To fully automate bootstrapping, you need to provide a way to extract the activation link (see "read_activation_link").
+function execute-bootstrap-user {
+    ssh_target -t 'bash bootstrap-user'
+}
+
+# Obtain the activation link in the variable "$link".
+#
+# This is required for activating the first bootstrappers account.
+# This is only required for automated bootstrap user.
+function read_activation_link {
+    read -rp "Link: " link
+    printf '%s\n' "$link"
+}
index 184e4889c7245a1bd916da234427857b89d1a273..7e7f1e1c400a4168fcd3277761b229457c3040e3 100755 (executable)
@@ -1,10 +1,8 @@
 #!/bin/bash
 #!/bin/bash
-function ssh_target {
-    ssh -i vm-key "$to" "$@"
-}
-target=$1
-target=${target%/}
-source "$target/config"
+targetHost=$1
+targetHost=${targetHost%/}
+source config
+source "$targetHost/config"
 
 echo "To: $to"
 echo "Agent: $SSH_AGENT_PID"
 
 echo "To: $to"
 echo "Agent: $SSH_AGENT_PID"
@@ -18,7 +16,7 @@ echo "Action: $command"
 if [[ $command == "push" ]]; then
     git push -f "$to:" "HEAD:refs/remotes/manager/master"
 else
 if [[ $command == "push" ]]; then
     git push -f "$to:" "HEAD:refs/remotes/manager/master"
 else
-    git fetch "$to:" "+HEAD:refs/remotes/$target/master"
+    git fetch "$to:" "+HEAD:refs/remotes/$targetHost/master"
 fi
 if [[ $oldpid == "" ]]; then
     eval $(ssh-agent -k)
 fi
 if [[ $oldpid == "" ]]; then
     eval $(ssh-agent -k)
index 2116eafb83301ee449fd30a95924780b25b21298..2e28c6079f60e99ac0b6a1f1d8076511961ec3dc 100755 (executable)
@@ -1,10 +1,8 @@
 #!/bin/bash
 #!/bin/bash
-signerLocation=self
-function ssh_target {
-    ssh -i vm-key "$to" "$@"
-}
-
-source "$1/config"
+targetHost=$1
+targetHost=${targetHost%/}
+source config
+source "$targetHost/config"
 
 function extract {
     pattern=$1
 
 function extract {
     pattern=$1
index 9481c85a57efad4f694f0a219d085abe4f0fa068..0fb4061da7b02515d946f880f020944f39ad8edb 100755 (executable)
@@ -1,30 +1,7 @@
 #!/bin/bash
 #!/bin/bash
-signerLocation=self
-devPkgs=""
-targetHost="$1"
-
-function ssh_target {
-    ssh -i vm-key "$to" "$@"
-}
-
-function install_nre {
-    ./installNRE "$targetHost"
-}
-function read_activation_link {
-    read -rp "Link: " link
-    printf '%s\n' "$link"
-}
-function configure {
-    ssh_target -t 'bash conf-puppet --force'
-    ssh_target 'sed -i "s%\$signerLocation = '".*'"'%\$signerLocation = '"'$signerLocation'"'%" environments/production/manifests/ip.pp'
-}
-function do_reset_vm {
-    read -rp "Please reset your VM and confirm by pressing enter." _
-}
-function execute-bootstrap-user {
-    ssh_target -t 'bash bootstrap-user'
-}
-
+targetHost=$1
+targetHost=${targetHost%/}
+source config
 source "$targetHost/config"
 
 eval $(ssh-agent)
 source "$targetHost/config"
 
 eval $(ssh-agent)