This repository has been archived by the owner on May 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
deploy.yml
95 lines (95 loc) · 2.96 KB
/
deploy.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---
- hosts: localhost
gather_facts: false
connection: local
vars_files:
- vars/defaults.yml
- vars/vars.yml
module_defaults:
group/aws:
profile: '{{ aws_profile }}'
region: '{{ aws_region }}'
tasks:
- set_fact:
cluster_size: '{{ ((desired_targets.cent_ssh + desired_targets.cisco_ios) / (instances[instance_type].mem_capacity / 40)) | round(0, "ceil") | int }}'
- cloudformation:
template: ./cfn/vpc-2azs.yaml
stack_name: scale-test-vpc
template_parameters:
ClassB: 99
- cloudformation:
template: ./cfn/ecs-static-size-cluster.yaml
stack_name: static-ecs-cluster
template_parameters:
ParentVPCStack: scale-test-vpc
SubnetsReach: Public
#InstanceType: c5.4xlarge
InstanceType: '{{ instance_type }}'
SpotBidPrice: 0.20
MaxSize: '{{ ((cluster_size|int * 1.5)) | int }}'
# 31144 is amount of container memory capacity on a c5.4xlarge
DesiredCapacity: '{{ cluster_size }}'
MinSize: 0
KeyName: '{{ key_name | default("") }}'
register: stack
- ecs_taskdefinition_facts:
task_definition: ssh-ansible-targets
register: ssh_def
- ecs_taskdefinition:
network_mode: bridge
family: 'ssh-ansible-targets'
state: present
containers:
- name: 'ssh-target'
image: '{{ repo_url }}:cent-ssh'
memoryReservation: 40
portMappings:
- containerPort: 22
hostPort: 0
protocol: tcp
when: >
not ('status' in ssh_def and ssh_def.status == 'ACTIVE')
- ecs_taskdefinition_facts:
task_definition: ios-ansible-targets
register: ios_def
- debug: var=ios_def
- ecs_taskdefinition:
network_mode: bridge
family: 'ios-ansible-targets'
state: present
containers:
- name: 'ios-target'
image: '{{ repo_url }}:cisco-ios-sim'
memoryReservation: 40
portMappings:
- containerPort: 22
hostPort: 0
protocol: tcp
when: >
not ('status' in ios_def and ios_def.status == 'ACTIVE')
- ecs_service:
state: present
cluster: '{{ stack.stack_outputs.Cluster }}'
name: ssh-targets-{{ item + 1 }}
deployment_configuration:
maximum_percent: 150
minimum_healthy_percent: 10
desired_count: '{{ (desired_targets.cent_ssh / 10) | int }}'
task_definition: ssh-ansible-targets
placement_strategy:
- field: instanceId
type: spread
loop: '{{ range(10) | list }}'
- ecs_service:
state: present
cluster: '{{ stack.stack_outputs.Cluster }}'
name: cisco-ios-targets-{{ item + 1 }}
deployment_configuration:
maximum_percent: 150
minimum_healthy_percent: 10
desired_count: '{{ (desired_targets.cisco_ios / 10) | int}}'
task_definition: ios-ansible-targets
placement_strategy:
- field: instanceId
type: spread
loop: '{{ range(10) | list }}'