Skip to content

Commit

Permalink
Merge pull request #124 from GomathiselviS/fix_ec2_networking
Browse files Browse the repository at this point in the history
Add module_defaults to ec2_networking_resources role

(cherry picked from commit 829bcf0)
  • Loading branch information
GomathiselviS authored and abikouo committed Jan 24, 2025
1 parent aaab9d7 commit b4f74b5
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions roles/ec2_networking_resources/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
- name: Run ec2_networking_resources role
module_defaults:
group/aws: "{{ aws_setup_credentials__output }}"
block:
- name: Create VPC
amazon.aws.ec2_vpc_net:
name: "{{ ec2_networking_resources_vpc_name }}"
cidr_block: "{{ ec2_networking_resources_vpc_cidr_block }}"
register: ec2_networking_resources_vpc_result

- name: Create VPC subnet
amazon.aws.ec2_vpc_subnet:
vpc_id: "{{ ec2_networking_resources_vpc_result.vpc.id }}"
cidr: "{{ ec2_networking_resources_subnet_cidr_block }}"
register: ec2_networking_resources_subnet_result

- name: Create route table
amazon.aws.ec2_vpc_route_table:
vpc_id: "{{ ec2_networking_resources_vpc_result.vpc.id }}"
subnets:
- "{{ ec2_networking_resources_subnet_result.subnet.id }}"

- name: Create security group for internal access
amazon.aws.ec2_security_group:
vpc_id: "{{ ec2_networking_resources_vpc_result.vpc.id }}"
name: "{{ ec2_networking_resources_sg_internal_name }}"
description: "{{ ec2_networking_resources_sg_internal_description }}"
rules: "{{ ec2_networking_resources_sg_internal_rules }}"

0 comments on commit b4f74b5

Please sign in to comment.