aws-vpc-subnet

Ansible role: AWS VPC Subnets

This role handles the creation of VPC subnets in AWS.

Build Status Version Ansible Galaxy

Requirements

  • Ansible 2.5

Additional variables

Additional variables that can be used (either as host_vars/group_vars or via command line args):

Variable Description
aws_vpc_subnet_profile Boto profile name to be used
aws_vpc_subnet_default_region Default region to use
aws_vpc_subnet_default_public Default visibility of subnets
aws_vpc_subnet_vpc_filter_additional Additional key val filter to add to vpc_filter and vpc_name by default.

Example definition

Required parameter only

aws_vpc_subnets:
  # Create subnets for a VPC by VPC name
  - vpc_name: devops-test-vpc
    subnets:
      - name: subnet-1
        cidr: 172.29.1.0/24
      - name: subnet-2
        cidr: 172.29.2.0/24
  # Create subnets for a VPC by VPC filter
  - vpc_filter:
      - key: "tag:Name"
        val: "devops-test-vpc"
    subnets:
      - name: subnet-1
        cidr: 172.29.1.0/24
      - name: subnet-2
        cidr: 172.29.2.0/24

All available parameter

aws_vpc_subnets:
  # Create subnets for a VPC by VPC name
  - vpc_name: devops-test-vpc
    region: eu-central-1
    subnets:
      - name: subnet-1
        cidr: 172.29.1.0./24
        az: a
        public: True
        tags:
          - key: env
            val: playground
          - key: department
            val: devops
      - name: subnet-2
        cidr: 172.29.2.0./24
        az: b
        public: True
        tags:
          - key: env
            val: playground
          - key: department
            val: devops
  # Create subnets for a VPC by VPC name
  - vpc_filter:
      - key: "tag:Name"
        val: "devops-test-vpc"
      - key: "tag:env"
        val: playground
      - key: "tag:department"
        val: devops
    region: eu-central-1
    subnets:
      - name: subnet-1
        cidr: 172.29.1.0./24
        az: a
        public: True
        tags:
          - key: env
            val: playground
          - key: department
            val: devops
      - name: subnet-2
        cidr: 172.29.2.0./24
        az: b
        public: True
        tags:
          - key: Name
            val: devops-test-subnet-b
          - key: env
            val: playground
          - key: department
            val: devops

Testing

Requirements

Run tests

# Lint the source files
make lint

# Run integration tests with default Ansible version
make test

# Run integration tests with custom Ansible version
make test ANSIBLE_VERSION=2.4
About

Creates an arbitrary number of subnets per VPC's on AWS

Install
ansible-galaxy install Flaconi/ansible-role-aws-vpc-subnet
GitHub repository
License
apache-2.0
Downloads
26