Can ayone findout what wil be the issue cannot able to create nat

10 views
Skip to first unread message

karthick selvam

unread,
May 6, 2018, 7:17:35 AM5/6/18
to Ansible Project
---
- name: Create AWS resources
  hosts: all
  connection: local
  gather_facts: False
  vars:
   aws_region: ap-south-1
  tasks:
  - ping:

  - name: Create VPC
    ec2_vpc:
     region: "{{aws_region}}"
     cidr_block: 10.0.0.0/16
     resource_tags:
      Environment: Development
    register: vpc  
    
  - name: create igw  
    ec2_vpc_igw:
     vpc_id: "{{vpc.vpc.id}}"
     region: "{{aws_region}}"
     state: present

  - name: Create subnets
    ec2_vpc_subnet:
     region: "{{aws_region}}"
     vpc_id: "{{vpc.vpc.id}}"
     cidr: "10.0.1.0/24"
     resource_tags:
      Environment: "Development"
    register: subnets 

  - name: Enable subnet Internet access
    ec2_vpc_route_table:
     vpc_id: "{{vpc.vpc.id}}"
     region: "{{aws_region}}"
     tags:
      Name: Public
     subnets:
     - "{{ subnets.subnet.id }}"
     routes:
     - dest: 0.0.0.0/0
       gateway_id: "igw"

  - name: Create subnets
    ec2_vpc_subnet:
     region: "{{aws_region}}"
     vpc_id: "{{vpc.vpc.id}}"
     cidr: "10.0.2.0/24"
     resource_tags:
      Environment: "Development"
    register: subnetss


  - name: Enable subnet Nat
    ec2_vpc_route_table:
     vpc_id: "{{vpc.vpc.id}}"
     region: "{{aws_region}}"
     tags:
      Name: Private
     subnets:
     - "{{ subnetss.subnet.id }}"
     routes:
     - dest: 0.0.0.0/0
       gateway_id: "nat"

Reply all
Reply to author
Forward
0 new messages