Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possibility to launch multiple VMs on EC2 (178 issue) #183

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions aws/bootnode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
from_port: 22
to_port: 22
cidr_ip: 0.0.0.0/0
rules_egress:
- proto: all
from_port: all
to_port: all
cidr_ip: 0.0.0.0/0
tags: bootnode


Expand All @@ -37,28 +32,28 @@
tasks:
- name: Launch instance
ec2:
id: "{{ bootnode_instance_name }}"
id: "{{ bootnode_instance_name }}-{{ item }}"
ec2_access_key: "{{ access_key }}"
ec2_secret_key: "{{ secret_key }}"
key_name: "{{ awskeypair_name }}"
instance_tags:
Name: "{{ bootnode_instance_name }}"
Name: "{{ bootnode_instance_name }}-{{ item }}"
group: "{{ bootnode_security_group }}"
instance_type: "{{ bootnode_instance_type }}"
image: "{{ image }}"
count: "{{ bootnode_count_instances }}"
wait: yes
region: "{{ region }}"
vpc_subnet_id: "{{ vpc_subnet_id }}"
volumes: "{{ volumes }}"
assign_public_ip: yes
with_sequence: "count={{ bootnode_count_instances }}"
register: ec2
- name: Add new instance to host group
add_host: hostname={{ item.public_ip }} groupname=launched
with_items: "{{ ec2.instances }}"
add_host: hostname={{ item.instances[0].public_ip }} groupname=launched
with_items: "{{ ec2.results }}"
- name: Wait for SSH to come up
wait_for: host={{ item.public_ip }} port=22 delay=90 timeout=320 state=started
with_items: "{{ ec2.instances }}"
wait_for: host={{ item.instances[0].public_ip }} port=22 delay=90 timeout=320 state=started
with_items: "{{ ec2.results }}"
when: ec2.changed
tags: bootnode

Expand Down
19 changes: 7 additions & 12 deletions aws/explorer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
from_port: 22
to_port: 22
cidr_ip: 0.0.0.0/0
rules_egress:
- proto: all
from_port: all
to_port: all
cidr_ip: 0.0.0.0/0
tags: explorer


Expand All @@ -37,28 +32,28 @@
tasks:
- name: Launch instance
ec2:
id: "{{ explorer_instance_name }}"
id: "{{ explorer_instance_name }}-{{ item }}"
ec2_access_key: "{{ access_key }}"
ec2_secret_key: "{{ secret_key }}"
key_name: "{{ awskeypair_name }}"
instance_tags:
Name: "{{ explorer_instance_name }}"
Name: "{{ explorer_instance_name }}-{{ item }}"
group: "{{ explorer_security_group }}"
instance_type: "{{ explorer_instance_type }}"
image: "{{ image }}"
count: "{{ explorer_count_instances }}"
wait: yes
region: "{{ region }}"
vpc_subnet_id: "{{ vpc_subnet_id }}"
volumes: "{{ volumes }}"
assign_public_ip: yes
with_sequence: "count={{ explorer_count_instances }}"
register: ec2
- name: Add new instance to host group
add_host: hostname={{ item.public_ip }} groupname=launched
with_items: "{{ ec2.instances }}"
add_host: hostname={{ item.instances[0].public_ip }} groupname=launched
with_items: "{{ ec2.results }}"
- name: Wait for SSH to come up
wait_for: host={{ item.public_ip }} port=22 delay=90 timeout=320 state=started
with_items: "{{ ec2.instances }}"
wait_for: host={{ item.instances[0].public_ip }} port=22 delay=90 timeout=320 state=started
with_items: "{{ ec2.results }}"
when: ec2.changed
tags: explorer

Expand Down
19 changes: 7 additions & 12 deletions aws/moc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
from_port: 22
to_port: 22
cidr_ip: 0.0.0.0/0
rules_egress:
- proto: all
from_port: all
to_port: all
cidr_ip: 0.0.0.0/0
tags: moc


Expand All @@ -37,28 +32,28 @@
tasks:
- name: Launch instance
ec2:
id: "{{ moc_instance_name }}"
id: "{{ moc_instance_name }}-{{ item }}"
ec2_access_key: "{{ access_key }}"
ec2_secret_key: "{{ secret_key }}"
key_name: "{{ awskeypair_name }}"
instance_tags:
Name: "{{ moc_instance_name }}"
Name: "{{ moc_instance_name }}-{{ item }}"
group: "{{ moc_security_group }}"
instance_type: "{{ moc_instance_type }}"
image: "{{ image }}"
count: "{{ moc_count_instances }}"
wait: yes
region: "{{ region }}"
vpc_subnet_id: "{{ vpc_subnet_id }}"
volumes: "{{ volumes }}"
assign_public_ip: yes
with_sequence: "count={{ explorer_count_instances }}"
register: ec2
- name: Add new instance to host group
add_host: hostname={{ item.public_ip }} groupname=launched
with_items: "{{ ec2.instances }}"
add_host: hostname={{ item.instances[0].public_ip }} groupname=launched
with_items: "{{ ec2.results }}"
- name: Wait for SSH to come up
wait_for: host={{ item.public_ip }} port=22 delay=90 timeout=320 state=started
with_items: "{{ ec2.instances }}"
wait_for: host={{ item.instances[0].public_ip }} port=22 delay=90 timeout=320 state=started
with_items: "{{ ec2.results }}"
when: ec2.changed
tags: moc

Expand Down
19 changes: 7 additions & 12 deletions aws/netstat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
from_port: 22
to_port: 22
cidr_ip: 0.0.0.0/0
rules_egress:
- proto: all
from_port: all
to_port: all
cidr_ip: 0.0.0.0/0
tags: netstat


Expand All @@ -37,28 +32,28 @@
tasks:
- name: Launch instance
ec2:
id: "{{ netstat_instance_name }}"
id: "{{ netstat_instance_name }}-{{ item }}"
ec2_access_key: "{{ access_key }}"
ec2_secret_key: "{{ secret_key }}"
key_name: "{{ awskeypair_name }}"
instance_tags:
Name: "{{ netstat_instance_name }}"
Name: "{{ netstat_instance_name }}-{{ item }}"
group: "{{ netstat_security_group }}"
instance_type: "{{ netstat_instance_type }}"
image: "{{ image }}"
count: "{{ netstat_count_instances }}"
wait: yes
region: "{{ region }}"
vpc_subnet_id: "{{ vpc_subnet_id }}"
volumes: "{{ volumes }}"
assign_public_ip: yes
with_items: "count={{ netstat_count_instances }}"
register: ec2
- name: Add new instance to host group
add_host: hostname={{ item.public_ip }} groupname=launched
with_items: "{{ ec2.instances }}"
add_host: hostname={{ item.instances[0].public_ip }} groupname=launched
with_items: "{{ ec2.results }}"
- name: Wait for SSH to come up
wait_for: host={{ item.public_ip }} port=22 delay=90 timeout=320 state=started
with_items: "{{ ec2.instances }}"
wait_for: host={{ item.instances[0].public_ip }} port=22 delay=90 timeout=320 state=started
with_items: "{{ ec2.results }}"
when: ec2.changed
tags: netstat

Expand Down
17 changes: 0 additions & 17 deletions aws/roles/bootnode-access/tasks/ec2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,6 @@
purge_rules: true
vpc_id: "{{ vpc_id }}"

- name: Allow outbound traffic
delegate_to: localhost
ec2_group:
ec2_access_key: "{{ access_key }}"
ec2_secret_key: "{{ secret_key }}"
name: "{{ bootnode_security_group }}"
description: "Default security group"
region: "{{ region }}"
purge_rules_egress: false
purge_rules: false
vpc_id: "{{ vpc_id }}"
rules_egress:
- proto: all
from_port: all
to_port: all
cidr_ip: 0.0.0.0/0

- name: Add ssh access
delegate_to: localhost
ec2_group:
Expand Down
17 changes: 0 additions & 17 deletions aws/roles/explorer-access/tasks/ec2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,6 @@
purge_rules: true
vpc_id: "{{ vpc_id }}"

- name: Allow outbound traffic
delegate_to: localhost
ec2_group:
ec2_access_key: "{{ access_key }}"
ec2_secret_key: "{{ secret_key }}"
name: "{{ explorer_security_group }}"
description: "Default security group"
region: "{{ region }}"
purge_rules_egress: false
purge_rules: false
vpc_id: "{{ vpc_id }}"
rules_egress:
- proto: all
from_port: all
to_port: all
cidr_ip: 0.0.0.0/0

- name: Add ssh access
delegate_to: localhost
ec2_group:
Expand Down
17 changes: 0 additions & 17 deletions aws/roles/moc-access/tasks/ec2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,6 @@
purge_rules: true
vpc_id: "{{ vpc_id }}"

- name: Allow outbound traffic
delegate_to: localhost
ec2_group:
ec2_access_key: "{{ access_key }}"
ec2_secret_key: "{{ secret_key }}"
name: "{{ moc_security_group }}"
description: "Default security group"
region: "{{ region }}"
purge_rules_egress: false
purge_rules: false
vpc_id: "{{ vpc_id }}"
rules_egress:
- proto: all
from_port: all
to_port: all
cidr_ip: 0.0.0.0/0

- name: Add ssh access
delegate_to: localhost
ec2_group:
Expand Down
17 changes: 0 additions & 17 deletions aws/roles/netstat-access/tasks/ec2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,6 @@
purge_rules: true
vpc_id: "{{ vpc_id }}"

- name: Allow outbound traffic
delegate_to: localhost
ec2_group:
ec2_access_key: "{{ access_key }}"
ec2_secret_key: "{{ secret_key }}"
name: "{{ netstat_security_group }}"
description: "Default security group"
region: "{{ region }}"
purge_rules_egress: false
purge_rules: false
vpc_id: "{{ vpc_id }}"
rules_egress:
- proto: all
from_port: all
to_port: all
cidr_ip: 0.0.0.0/0

- name: Add ssh access
delegate_to: localhost
ec2_group:
Expand Down
17 changes: 0 additions & 17 deletions aws/roles/validator-access/tasks/ec2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,6 @@
purge_rules: true
vpc_id: "{{ vpc_id }}"

- name: Allow outbound traffic
delegate_to: localhost
ec2_group:
ec2_access_key: "{{ access_key }}"
ec2_secret_key: "{{ secret_key }}"
name: "{{ validator_security_group }}"
description: "Default security group"
region: "{{ region }}"
purge_rules_egress: false
purge_rules: false
vpc_id: "{{ vpc_id }}"
rules_egress:
- proto: all
from_port: all
to_port: all
cidr_ip: 0.0.0.0/0

- name: Add ssh access
delegate_to: localhost
ec2_group:
Expand Down
19 changes: 7 additions & 12 deletions aws/validator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
from_port: 22
to_port: 22
cidr_ip: 0.0.0.0/0
rules_egress:
- proto: all
from_port: all
to_port: all
cidr_ip: 0.0.0.0/0
tags: validator


Expand All @@ -37,28 +32,28 @@
tasks:
- name: Launch instance
ec2:
id: "{{ validator_instance_name }}"
id: "{{ validator_instance_name }}-{{ item }}"
ec2_access_key: "{{ access_key }}"
ec2_secret_key: "{{ secret_key }}"
key_name: "{{ awskeypair_name }}"
instance_tags:
Name: "{{ validator_instance_name }}"
Name: "{{ validator_instance_name }}-{{ item }}"
group: "{{ validator_security_group }}"
instance_type: "{{ validator_instance_type }}"
image: "{{ image }}"
count: "{{ validator_count_instances }}"
wait: yes
region: "{{ region }}"
vpc_subnet_id: "{{ vpc_subnet_id }}"
volumes: "{{ volumes }}"
assign_public_ip: yes
with_items: "count={{ validator_count_instances }}"
register: ec2
- name: Add new instance to host group
add_host: hostname={{ item.public_ip }} groupname=launched
with_items: "{{ ec2.instances }}"
add_host: hostname={{ item.instances[0].public_ip }} groupname=launched
with_items: "{{ ec2.results }}"
- name: Wait for SSH to come up
wait_for: host={{ item.public_ip }} port=22 delay=90 timeout=320 state=started
with_items: "{{ ec2.instances }}"
wait_for: host={{ item.instances[0].public_ip }} port=22 delay=90 timeout=320 state=started
with_items: "{{ ec2.results }}"
when: ec2.changed
tags: validator

Expand Down