Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add module_defaults to ec2_networking_resources role #124

Merged
merged 4 commits into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions roles/ec2_networking_resources/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
---
- 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: 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 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 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 }}"
- 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 }}"
Loading