forked from leerich/network-poc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.yml
78 lines (69 loc) · 1.98 KB
/
demo.yml
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# demo_setup.yml
- hosts: localhost
connection: local
gather_facts: False
tasks:
- name: Provision a Webserver Instance
ec2:
key_name: lrich-key
region: us-east-1
group_id: sg-ec606896
instance_type: t2.micro
image: ami-2051294a
vpc_subnet_id: subnet-f0ab60a8
assign_public_ip: yes
exact_count: 1
count_tag:
Name: demo_Webserver
wait: true
instance_tags:
ansible_group: webservers
Name: demo_Webserver
tags:
- webserver
register: ec2
- name: Add all instances public IPs to host group
add_host: hostname="{{ item.public_ip }}" groupname=webservers
with_items: "{{ ec2.instances }}"
- name: Provision a DBServer Instance
ec2:
key_name: lrich-key
region: us-east-1
group_id: sg-ec606896
instance_type: t2.micro
image: ami-2051294a
vpc_subnet_id: subnet-f0ab60a8
assign_public_ip: yes
exact_count: 1
count_tag:
Name: demo_Dbserver
wait: true
instance_tags:
ansible_group: dbservers
Name: demo_Dbserver
tags:
- dbserver
register: ec2
- name: Add all instances public IPs to host group
add_host: hostname="{{ item.public_ip }}" groupname=dbservers
with_items: "{{ ec2.instances }}"
#with_items: "{{ tag_Name_Dbserver }}"
- name: Provision a Jenkins Instance
ec2:
key_name: lrich-key
region: us-east-1
group_id: sg-ec606896
instance_type: t2.micro
image: ami-2051294a
vpc_subnet_id: subnet-f0ab60a8
assign_public_ip: yes
exact_count: 1
count_tag:
Name: demo_Jenkins
wait: true
instance_tags:
ansible_group: jenkins
Name: demo_Jenkins
tags:
- jenkins
register: ec2