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 python | |
# -*- coding: utf-8 -*- | |
from __future__ import print_function | |
from __future__ import unicode_literals | |
from __future__ import division | |
import re | |
import signal | |
import sys | |
import time |
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 true; do | |
INDEX_FILE="$(mktemp -t consul_index_XXX)" | |
CONSUL_INDEX=$( | |
curl -isL -H "X-Auth-Token: $CONSUL_TOKEN" \ | |
-H 'X-Consul-Index: 1' \ | |
--cacert /etc/consul/ssl/ca.cert "https://consul.service.consul:8500/v1/event/list?index=$CONSUL_INDEX&wait=1m" | \ | |
tee "$INDEX_FILE" | \ | |
grep X-Consul-Index | \ | |
sed -e 's/^.*: *//' | \ |
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 | |
pkcs7=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/pkcs7 | paste -s -d '') | |
result=$(curl -X POST "http://10.0.1.130:8200/v1/auth/aws-ec2/login" -d '{"role":"myapp","pkcs7":"'"$pkcs7"'","nonce":"vault-client-nonce"}') | |
token=$( jq -r .auth.client_token <<< "$result" ) | |
policies=$( jq -r .auth.policies[] <<< "$result" ) | |
ami_id=$( jq -r .auth.metadata.ami_id <<< "$result" ) | |
[[ -n $token ]] || 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
$instances = (Get-ec2instance -region us-east-1 ).Instances | |
$servers = @() | |
foreach( $instance in $instances) { | |
$ipAddrs+=$instance.PrivateIpAddress | |
} | |
foreach ($ip in $ipAddrs) { | |
write-host $ip | |
} |
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
GROUP=$(ec2-describe-tags --filter "resource-type=instance" --filter "resource-id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)" --filter "key=aws:autoscaling:groupName" | cut -f5) | |
IDS=$(aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names $GROUP --query 'AutoScalingGroups[0].Instances[].InstanceId' --output text | sed 's/\t/ /g') | |
IPS=$(aws ec2 describe-instances --instance-ids $IDS --region us-east-1 --query Reservations[].Instances[].PrivateIpAddress --output text | sed 's/\t/,/g') | |
LAUNCH_TIME=$(date -d $(aws ec2 describe-instances --instance-ids `curl -s http://169.254.169.254/latest/meta-data/instance-id` --query Reservations[].Instances[0].LaunchTime --output text)) | |
LAUNCH_TIMES=$(aws ec2 describe-instances --instance-ids $IDS --region us-east-1 --query Reservations[].Instances[].LaunchTime --output text) |
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
--- | |
# ^^^ YAML documents must begin with the document separator "---" | |
# | |
#### Example docblock, I like to put a descriptive comment at the top of my | |
#### playbooks. | |
# | |
# Overview: Playbook to bootstrap a new host for configuration management. | |
# Applies to: production | |
# Description: | |
# Ensures that a host is configured for management with Ansible. |
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
"""Delete all services in an ECS Cluster using boto3. | |
Requires listing all services in a cluster, setting their desired tasks to 0, | |
then deleting the service. | |
""" | |
import boto3 | |
CLUSTER_NAME = 'your-cluster-here' |
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
mvn help:evaluate -Dexpression=project.version | grep -e '^[^\[]' |
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 -e | |
# Those should be JENKINS vars | |
NAME=nginx-deployment-3 | |
PODS_COUNT=3 | |
CONTAINER_NAME=nginx | |
DOCKER_IMAGE='nginx:1.8' | |
# Template can be copied from deploy.tmp.yaml to update jenkins var |
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 | |
# | |
# Get all IPs from an autoscale group and update set the local ip as | |
# equal weight A entries (round robin dns). Takes autoscale group as | |
# parameter. | |
# | |
# Amit Bakshi | |
# 10/21/2014 | |
# |
OlderNewer