-
Notifications
You must be signed in to change notification settings - Fork 18
/
provision-basic-asg-playbook.yml
70 lines (65 loc) · 1.69 KB
/
provision-basic-asg-playbook.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
---
- hosts: localhost
connection: local
gather_facts: false
vars:
image: '{{ ami }}'
architecture: 'workshop-basic'
loadb: '{{ architecture }}-lb'
auto_sc: '{{ architecture }}_asg'
lc: '{{ architecture }}_lc'
vars_files:
- amiKeys.yml
- regionInfo.yml
tasks:
- name: ELB
ec2_elb_lb:
scheme: internal
aws_access_key: '{{ ami_access }}'
aws_secret_key: '{{ ami_secret }}'
name: '{{ loadb }}'
region: '{{ regi }}'
subnets: '{{ subnetID }}'
security_group_ids: '{{ elb_security_group_ids }}'
state: '{{ state }}'
listeners:
- protocol: http
load_balancer_port: 80
instance_port: 8080
- name: Launch Configuration
tags:
- lc
ec2_lc:
aws_access_key: '{{ ami_access }}'
aws_secret_key: '{{ ami_secret }}'
region: '{{ regi }}'
name: '{{ lc }}'
image_id: '{{ image }}'
key_name: '{{ keypair }}'
security_groups: '{{ group }}'
instance_type: t2.micro
volumes:
- device_name: /dev/sda1
volume_size: 100
device_type: io1
iops: 3000
delete_on_termination: true
user_data: '{{ bootstrap_content }}'
state: '{{ state }}'
- name: Auto-scaling group
tags:
- asg
ec2_asg:
aws_access_key: '{{ ami_access }}'
aws_secret_key: '{{ ami_secret }}'
region: '{{ regi }}'
name: '{{ auto_sc }}'
load_balancers: '{{ loadb }}'
launch_config_name: '{{ lc }}'
min_size: 2
max_size: 4
desired_capacity: 2
vpc_zone_identifier: '{{ subnetID }}'
wait_for_instances: false
tags: '{{ tags }}'
state: '{{ state }}'