-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateSecurityGroups.yml
More file actions
57 lines (53 loc) · 1.54 KB
/
Copy pathcreateSecurityGroups.yml
File metadata and controls
57 lines (53 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
- hosts: localhost # put localhost. We are processing against aws
connection: local # put local. We are processing against aws
gather_facts: False # don't gather facts against localhost
tasks:
- name: Get Default Security Group
ec2_group_info:
region: "{{ region }}"
register: defaultSG
- name: set Security Group
ec2_group:
vpc_id: "{{ vpc_id }}"
region: "{{ region }}"
description: 'default'
name: ''
tags:
Name: 'PublicSecurity-Group'
- name: Set Default SG ID in variable
set_stats:
data:
security_group_default: "{{ defaultSG }}"
- name: Create Management Security Group
ec2_group:
name: SGManagenet
description: DMZ Security Group
vpc_id: "{{ vpc_id }}"
region: "{{ region }}"
rules:
- rule_desc: Allow all from vpc
proto: -1
ports: -1
cidr_ip: "{{ vpc_cidr }}"
- rule_desc: Allow ssh
proto: tcp
ports: 22
cidr_ip: "{{ destinationCidrBlock }}"
- rule_desc: Allow https
proto: tcp
ports: 443
cidr_ip: "{{ destinationCidrBlock }}"
- rule_desc: Allow 18190
proto: tcp
ports: 18190
cidr_ip: "{{ destinationCidrBlock }}"
- rule_desc: Allow 19009
proto: tcp
ports: 19009
cidr_ip: "{{ destinationCidrBlock }}"
register: SGMGMT
- name: Set MgMT SG ID in variable
set_stats:
data:
security_group_mgmt: "{{ SGMGMT }}"