Skip to content

Instantly share code, notes, and snippets.

View maishsk's full-sized avatar

Maish Saidel-Keesing maishsk

View GitHub Profile
@maishsk
maishsk / compile-vault.sh
Last active November 17, 2019 18:19
Creating an aws-vault executable for arm
## Install go
sudo apt-get install -y golang-go
## Setup environment variables for go
mkdir ~/go-dir
export GOPATH="$HOME/go-dir/"
#compile directly from github
go get -u github.com/99designs/aws-vault
@maishsk
maishsk / gist:c7af69fe1bd795ee260cbc7482f7ce33
Last active July 5, 2018 08:28
terraform-intermediate-results
root@maishsk-lin:/opt/git/automation-standoff/intermediate/terraform# for i in {1..3}; do echo "starting run $i"; echo "create" ; time terraform apply -auto-approve ; echo "destroy" ; time terraform destroy -auto-approve; done
starting run 1
create
aws_eip.eip1: Creating...
allocation_id: "" => "<computed>"
association_id: "" => "<computed>"
domain: "" => "<computed>"
instance: "" => "<computed>"
network_interface: "" => "<computed>"
@maishsk
maishsk / gist:2bf6e9dfc0d569e0b2e6a677ea1f02ab
Created July 5, 2018 08:15
Cloudformation-intermediate-results
root@maishsk-lin:/opt/git/automation-standoff/intermediate/cloudformation# for i in {1..3}; do echo "Starting run $i"; echo "Create"; aws cloudformation create-stack --stack-name testvpc --template-body file://vpc_cloudformation_template.yml; time aws cloudformation wait stack-create-complete --stack-name testvpc --no-paginate; echo "Destroy"; aws cloudformation delete-stack --stack-name testvpc; time aws cloudformation wait stack-delete-complete --stack-name testvpc; done
Starting run 1
Create
{
"StackId": "arn:aws:cloudformation:us-east-2:138XXXXX2836:stack/testvpc/ffa34260-8018-11e8-a6b1-0aca70d92d08"
}
3m36.391s
Destroy
@maishsk
maishsk / gist:a303ef5f604aab641fbc6e24395a4161
Created July 5, 2018 07:58
Ansible-intermediate results
root@maishsk-lin:/opt/git/automation-standoff/intermediate/ansible# for i in {1..3}; do echo "starting run $i"; echo "create"; time ansible-playbook create-vpc.yml ; echo "destroy"; time ansible-playbook remove-vpc.yml ; done
starting run 1
create
[WARNING]: Unable to parse /etc/ansible/hosts as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [VPC creation playbook] ****************************************************************************************************************************************************************************************
TASK [Create a VPC] *************************************************************************************************************************************************************************************************
@maishsk
maishsk / vars.tf
Created July 5, 2018 05:18
New variables
variable "pub1_cidr" {
description = "The CIDR block for the public subnet in us-east-2a"
default = "192.168.90.0/26"
}
variable "pub2_cidr" {
description = "The CIDR block for the public subnet in us-east-2b"
default = "192.168.90.64/26"
}
variable "private1_cidr" {
description = "The CIDR block for the private subnet in us-east-2a"
@maishsk
maishsk / create-vpc.tf
Created July 5, 2018 05:16
create VPC iwth subnets
resource "aws_vpc" "testvpc" {
cidr_block = "${var.vpc_cidr}"
enable_dns_hostnames = true
tags {
Name = "${var.project_name}"
}
}
resource "aws_subnet" "pub1_subnet" {
vpc_id = "${aws_vpc.testvpc.id}"
pub1_cidr: 192.168.90.0/26
pub2_cidr: 192.168.90.64/26
private1_cidr: 192.168.90.128/26
private2_cidr: 192.168.90.192/26
pub1_name: "Public Subnet (AZ1)"
pub2_name: "Public Subnet (AZ2)"
priv1_name: "Private Subnet (AZ1)"
priv2_name: "Private Subnet (AZ2)"
az1: us-east-2a
az2: us-east-2b
@maishsk
maishsk / create-vpc.yml
Created July 5, 2018 05:09
Create VPC with ansible - part 2
---
- name: VPC creation playbook
hosts: localhost
connection: local
gather_facts: no
vars_files:
- vars/vpc_vars.yml
tasks:
@maishsk
maishsk / gist:8254a58959600ae3bcd4309b12bbb0f8
Created July 2, 2018 14:37
playing with variables in ansible
---
- name: VPC creation playbook
hosts: localhost
connection: local
gather_facts: no
vars_files:
- vars/vpc_vars.yml
tasks:
# - name: Create subnets for Private networks
# ec2_vpc_subnet:
# state: present
# az: "{{ item.sub.az }}"
# vpc_id: "{{ vpc.vpc.id }}"
# region: "{{ region }}"
# cidr: "{{ item.sub.cidr }}"
# resource_tags:
# Name: "{{ item.sub.name }}"
# with_items: "{{ private_sub_list }}"