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
## 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 |
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
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>" |
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
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 |
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
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] ************************************************************************************************************************************************************************************************* |
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
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" |
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
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}" |
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
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 |
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
--- | |
- name: VPC creation playbook | |
hosts: localhost | |
connection: local | |
gather_facts: no | |
vars_files: | |
- vars/vpc_vars.yml | |
tasks: |
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
--- | |
- name: VPC creation playbook | |
hosts: localhost | |
connection: local | |
gather_facts: no | |
vars_files: | |
- vars/vpc_vars.yml | |
tasks: |
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
# - 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 }}" |