-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Stefan Oehrli
committed
Dec 16, 2021
1 parent
b8320dd
commit 67e83cb
Showing
9 changed files
with
86 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
# ------------------------------------------------------------------------------ | ||
# Trivadis - Part of Accenture, Platform Factory - Transactional Data Platform | ||
# Saegereistrasse 29, 8152 Glattbrugg, Switzerland | ||
# ------------------------------------------------------------------------------ | ||
# Name.......: bastion_config.template.sh | ||
# Author.....: Stefan Oehrli (oes) [email protected] | ||
# Editor.....: Stefan Oehrli | ||
# Date.......: 2021.12.16 | ||
# Revision...: | ||
# Purpose....: Script to configure the bastion host after bootstrap | ||
# Notes......: -- | ||
# Reference..: -- | ||
# License....: Apache License Version 2.0, January 2004 as shown | ||
# at http://www.apache.org/licenses/ | ||
# ------------------------------------------------------------------------------ | ||
# - Customization -------------------------------------------------------------- | ||
HOST=${HOST:-$(hostname)} | ||
# - End of Customization ------------------------------------------------------- | ||
|
||
# - Default Values ------------------------------------------------------------- | ||
# source genric environment variables and functions | ||
export SCRIPT_NAME=$(basename $0) # script name | ||
export SCRIPT_BIN_DIR=$(dirname $0) # script bin directory | ||
# define logfile and logging | ||
export LOG_BASE=${LOG_BASE:-"$SCRIPT_BIN_DIR"} # Use script directory as default logbase | ||
# Define Logfile but first reset LOG_BASE if directory does not exists | ||
if [ ! -d ${LOG_BASE} ] || [ ! -w ${LOG_BASE} ] ; then | ||
echo "INFO : set LOG_BASE to /tmp" | ||
export LOG_BASE="/tmp" | ||
fi | ||
TIMESTAMP=$(date "+%Y.%m.%d_%H%M%S") | ||
readonly LOGFILE="$LOG_BASE/$(basename $SCRIPT_NAME .sh)_$TIMESTAMP.log" | ||
# - EOF Default Values --------------------------------------------------------- | ||
|
||
# - Initialization ------------------------------------------------------------- | ||
# Define a bunch of bash option see | ||
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html | ||
set -o nounset # stop script after 1st cmd failed | ||
set -o errexit # exit when 1st unset variable found | ||
set -o pipefail # pipefail exit after 1st piped commands failed | ||
|
||
# initialize logfile | ||
touch $LOGFILE 2>/dev/null | ||
exec &> >(tee -a "$LOGFILE") # Open standard out at `$LOG_FILE` for write. | ||
exec 2>&1 | ||
|
||
echo "INFO: Start post bootstrap bastion configuration on host $(hostname) at $(date)" | ||
|
||
echo "INFO: Finish post bootstrap bastion configuration on host $(hostname) at $(date)" | ||
# --- EOF ---------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ Variables for the configuration of the terraform module, defined in [variables]( | |
| `admin_email` | Admin email used to configure Let's encrypt. | | [email protected] | | ||
| `bastion_boot_volume_size` | Size of the boot volume. | | 50 | | ||
| `bootstrap_cloudinit_template` | Bootstrap script to provision the bastion host. | | n/a | | ||
| `post_bootstrap_config` | Post Bootstrap script to provision the bastion host. | | n/a | | ||
| `bastion_dns_registration` | Whether to register the bastion host in DNS zone. | true/false | true | | ||
| `bastion_enabled` | Whether to create the bastion host or not. | true/false | false | | ||
| `bastion_image_id` | Provide a custom image id for the bastion host or leave as OEL (Oracle Enterprise Linux). | OCID | OEL | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters