mateothegreat.aws_vpc_create
Create AWS VPC
Features:
- Creates optional peering connections.
- Supports tagging for all resources.
This role will create a new AWS VPC that includes:
- Peering connection(s)
- Internet gateway
- NAT gateway(s)
- Route table(s)
- Subnet(s)
Requirements
pip install ansible boto3 boto
Variables
aws_vpc_create:
profile: "default" # Name of the AWS credentials profile.
name: "test-1" # Name of the new VPC.
region: "eu-central-1" # AWS region to create the VPC in.
cidr: "201.0.0.0/16" # CIDR block for the entire VPC.
internet_gateway: "true" # Create an internet gateway.
nat_gateway: "true" # Create a NAT gateway with an elastic IP.
allow_duplicate_name: "false" # Don't allow duplicate VPC names.
allow_duplicate_cidr: "false" # Don't allow duplicate CIDR blocks.
purge_cidrs: "true" # Remove all CIDRs if using an existing VPC.
peering:
- name: "test-1-peer"
vpc_id: "vpc-0504d01b93f46e610"
region: "eu-central-1"
cidr: "22.16.0.0/16"
update_accepter_route_table: "true" # Add route back to this VPC on the acceptor's route table.
dns:
enable_support: "true" # Enable DNS support for this VPC.
enable_hostnames: "true" # Enable hostname resolution for this VPC.
subnets:
- name: "public-1"
type: "public"
az: "eu-central-1a"
cidr: "201.0.1.0/24"
- name: "public-2"
type: "public"
cidr: "201.0.2.0/24"
az: "eu-central-1b"
- name: "private-1"
type: "private"
cidr: "201.0.3.0/24"
az: "eu-central-1a"
- name: "private-2"
type: "private"
cidr: "201.0.4.0/24"
az: "eu-central-1b"
tags:
created_by: "Matthew Davis"
Example Usage
Add the following to a file named playbook.yaml
:
- hosts: monitoring
roles:
- role: "mateothegreat.aws_vpc_create"
vars:
aws_vpc_create:
profile: "default" # Name of the AWS credentials profile.
name: "test-1" # Name of the new VPC.
region: "eu-central-1" # AWS region for the VPC.
cidr: "201.0.0.0/16" # CIDR block for the VPC.
internet_gateway: "true" # Create an internet gateway.
nat_gateway: "true" # Create a NAT gateway with an elastic IP.
allow_duplicate_name: "false" # Don't allow duplicate VPC names.
allow_duplicate_cidr: "false" # Don't allow duplicate CIDR blocks.
purge_cidrs: "true" # Remove all CIDRs if using an existing VPC.
peering:
- name: "test-1-peer"
vpc_id: "vpc-0504d01b93f46e610"
region: "eu-central-1"
cidr: "22.16.0.0/16"
update_accepter_route_table: "true" # Add route back to this VPC on the acceptor's route table.
dns:
enable_support: "true" # Enable DNS support for this VPC.
enable_hostnames: "true" # Enable hostname resolution for this VPC.
subnets:
- name: "public-1"
type: "public"
az: "eu-central-1a"
cidr: "201.0.1.0/24"
- name: "public-2"
type: "public"
cidr: "201.0.2.0/24"
az: "eu-central-1b"
- name: "private-1"
type: "private"
cidr: "201.0.3.0/24"
az: "eu-central-1a"
- name: "private-2"
type: "private"
cidr: "201.0.4.0/24"
az: "eu-central-1b"
tags:
created_by: "Matthew Davis"
Run with ansible-playbook -i <your inventory file> playbook.yaml
.
Contact
You can contact me at https://matthewdavis.io.
Installa
ansible-galaxy install mateothegreat.aws_vpc_create
Licenza
Unknown
Download
120
Proprietario
🚀 ☞ Senior Software Architect, Cloud Engineer & DevOps Advocate. ✌