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
#!/bin/bash | |
while : ; do | |
kubectl get [your thing] && break | |
sleep 1 | |
done |
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
#!/bin/bash | |
set -ex | |
for i in $(k get pvc | awk '{if(NR>1)print $1}'); | |
do | |
kubectl delete pvc $i | |
done |
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
#!/bin/bash | |
set -ex | |
for i in $(kubectl get pv | awk '{print $1}'); | |
do | |
kubectl patch pv $i --type=json -p '[{"op": "remove", "path": "/spec/claimRef"}]' | |
done |
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
#!/usr/bin/env bash | |
if [ "$AWS_PROFILE" = "" ]; then | |
echo "No AWS_PROFILE set" | |
exit 1 | |
fi | |
for region in $(aws ec2 describe-regions --region eu-west-1 | jq -r .Regions[].RegionName); do |
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
#!/bin/bash | |
export AWS_REGION="us-west-2" | |
account_id=$1 | |
temp_role=$(aws sts assume-role \ | |
--role-arn "arn:aws:iam::${account_id}:role/AWSControlTowerExecution" \ | |
--role-session-name "aws-ct-mgmt") | |
unset AWS_ACCESS_KEY_ID |
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
#!/bin/sh | |
#exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1 | |
sudo apt update -y | |
sudo apt install -y software-properties-common | |
sudo add-apt-repository --yes --update ppa:ansible/ansible | |
sudo apt install -y ansible python3-pip vim git | |
pip3 install boto3 botocore |
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
import json | |
import boto3 | |
EC2_INSTANCE_ID="i-xxxxxx" | |
ec2_handle = boto3.client( | |
'ec2' | |
) | |
def lambda_handler(event, context): |
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
#!/bin/bash | |
set -x | |
set -e | |
S3_BUCKET="" | |
S3_PREFIX="" | |
OBJECT="$(aws s3 ls s3://$S3_BUCKET/$S3_PREFIX | sort | tail -n 1 | awk '{print $4}')" | |
[ -z "$OBJECT" ] && echo "Object not found in S3 Bucket." && exit 1 |
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
# If something goes wrong, this script does not run forever but times out | |
TIMEOUT_SECONDS=300 | |
# Logfile for the keycloak export instance | |
LOGFILE=/tmp/standalone.sh.log | |
# destionation export file | |
JSON_EXPORT_FILE=/tmp/realms-export-single-file.json | |
rm -f ${LOGFILE} ${JSON_EXPORT_FILE} | |
# Start a new keycloak instance with exporting options enabled. |
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
#!/bin/sh | |
# If something goes wrong, this script does not run forever but times out | |
TIMEOUT_SECONDS=300 | |
# Logfile for the keycloak export instance | |
LOGFILE=/tmp/standalone.sh.log | |
# destionation export file | |
JSON_IMPORT_FILE=/opt/jboss/keycloak/imports/realm-export.json |
NewerOlder