Giter Club home page Giter Club logo

ansible-role-aws-vpc-nat's Introduction

Ansible role: AWS VPC NAT

This role is able to create any number of NAT gateways per VPC and per subnet.

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_nat_profile Boto profile name to be used
aws_vpc_nat_default_region Default region to use
aws_vpc_nat_eip_filter_additional Additional key val filter to add to eip_filter and eip_name by default
aws_vpc_nat_subnet_filter_additional Additional key val filter to add to subnet_filter and subnet_name by default

Example definition

With sane defaults

When using the sane defaults, the only thing to configure for each nat gateway is:

  • either the subnet_filter to find one unique subnet by filter (tags, ids, etc)
  • or the subnet_name to find one unique subnet by name
aws_vpc_nat_gateway:
  # Add Nat GW to a subnet found by filter and create EIP automatically
  - name: natgw-1
    subnet_filter:
      - key: "tag:Name"
        val: "sn-1"
  # Add Nat GW to a subnet found by name and create EIP automatically
  - name: natgw-2
    subnet_name: sn-2

All available parameter

Instead of using somebody's sane defaults, you can also add tags for each nat gateway.

# Ensure subnet filter (name or filter)
# includes that their state is already created. (not pending nor deleted)
aws_vpc_nat_eip_filter_additional:
  - key: state
    val: available

# Ensure EIP filter (name or filter)
# includes that their owned by a vpc
aws_vpc_nat_subnet_filter_additional:
  - key: domain
    val: vpc

aws_vpc_nat_gateway:
  # Add Nat GW to a subnet found by filter
  - name: natgw-1
    subnet_filter:
      - key: "tag:Name"
        val: "sn-1"
    # re-use existing EIP found by filter
    eip_flter:
      - key: "tag:Name"
        val: "eip-1"
    tags:
      - key: env
        val: production
    region: eu-central-1

  # Add Nat GW to a subnet found by name
  - name: natgw-2
    subnet_name: sn-2
    # re-use existing EIP found by name
    eip_name: eip-2
    tags:
      - key: env
        val: testing

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.