generated from ansible-collections/collection_template
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b443c35
commit 5a3780a
Showing
2 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
extensions/experiences/configure_aws_network/playbooks/run_configure_aws_network.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
- name: Create necessary network resources | ||
hosts: localhost | ||
gather_facts: false | ||
tasks: | ||
- name: Create a list of dictionaries for security group rules | ||
ansible.builtin.set_fact: | ||
sg_internal_rules: >- | ||
{{ | ||
[ | ||
{ | ||
'proto': security_group_1_proto, | ||
'ports': security_group_1_port, | ||
'cidr_ip': security_group_1_cidr | ||
}, | ||
{ | ||
'proto': security_group_2_proto, | ||
'ports': security_group_2_port, | ||
'cidr_ip': security_group_2_cidr | ||
}, | ||
{ | ||
'proto': security_group_3_proto, | ||
'ports': security_group_3_port, | ||
'cidr_ip': security_group_3_cidr | ||
} | ||
] | selectattr('proto', 'defined') | selectattr('ports', 'defined') | selectattr('cidr_ip', 'defined') | list | ||
}} | ||
- name: Set default value for the security group rules if nothing is passed. | ||
ansible.builtin.set_fact: | ||
sg_internal_rules: "{{ sg_internal_rules | default([ | ||
Check warning on line 31 in extensions/experiences/configure_aws_network/playbooks/run_configure_aws_network.yaml GitHub Actions / ansible-lintjinja[spacing]
|
||
{'proto': 'tcp', 'port': '22', 'cidr_ip': vpc_cidr} | ||
]) }}" | ||
|
||
- name: Configure Network resources | ||
ansible.builtin.include_role: | ||
name: cloud.aws_ops.ec2_networking_resources | ||
vars: | ||
aws_region: "{{ region }}" | ||
Check failure on line 39 in extensions/experiences/configure_aws_network/playbooks/run_configure_aws_network.yaml GitHub Actions / ansible-lintvar-naming[no-role-prefix]
|
||
ec2_networking_resources_vpc_name: "{{ vpc_name }}" | ||
ec2_networking_resources_vpc_cidr_block: "{{ vpc_cidr }}" | ||
ec2_networking_resources_subnet_cidr_block: "{{ subnet }}" | ||
ec2_networking_resources_sg_internal_name: "{{ security_group_internal }}" | ||
ec2_networking_resources_sg_internal_description: "{{ security_group_internal_description }}" | ||
ec2_networking_resources_sg_internal_rules: "{{ sg_internal_rules }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters