From abb1daaa512ba6e67a0daaad4b85abaca697e965 Mon Sep 17 00:00:00 2001 From: ArseniiPetrovich Date: Tue, 20 Nov 2018 20:42:47 +0300 Subject: [PATCH 1/3] Fix 177 issue --- aws/bootnode.yml | 5 ----- aws/explorer.yml | 5 ----- aws/moc.yml | 5 ----- aws/netstat.yml | 5 ----- aws/roles/bootnode-access/tasks/ec2.yml | 17 ----------------- aws/roles/explorer-access/tasks/ec2.yml | 17 ----------------- aws/roles/moc-access/tasks/ec2.yml | 17 ----------------- aws/roles/netstat-access/tasks/ec2.yml | 17 ----------------- aws/roles/validator-access/tasks/ec2.yml | 17 ----------------- aws/validator.yml | 5 ----- 10 files changed, 110 deletions(-) diff --git a/aws/bootnode.yml b/aws/bootnode.yml index 09cdadd..fe5451c 100644 --- a/aws/bootnode.yml +++ b/aws/bootnode.yml @@ -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 diff --git a/aws/explorer.yml b/aws/explorer.yml index d7b6d53..d3023ca 100644 --- a/aws/explorer.yml +++ b/aws/explorer.yml @@ -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 diff --git a/aws/moc.yml b/aws/moc.yml index 81d44b0..219eef5 100644 --- a/aws/moc.yml +++ b/aws/moc.yml @@ -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 diff --git a/aws/netstat.yml b/aws/netstat.yml index 0e44f23..19c3767 100644 --- a/aws/netstat.yml +++ b/aws/netstat.yml @@ -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 diff --git a/aws/roles/bootnode-access/tasks/ec2.yml b/aws/roles/bootnode-access/tasks/ec2.yml index e80bdcc..d96bc36 100644 --- a/aws/roles/bootnode-access/tasks/ec2.yml +++ b/aws/roles/bootnode-access/tasks/ec2.yml @@ -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: diff --git a/aws/roles/explorer-access/tasks/ec2.yml b/aws/roles/explorer-access/tasks/ec2.yml index 8e4bc70..6694e72 100644 --- a/aws/roles/explorer-access/tasks/ec2.yml +++ b/aws/roles/explorer-access/tasks/ec2.yml @@ -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: diff --git a/aws/roles/moc-access/tasks/ec2.yml b/aws/roles/moc-access/tasks/ec2.yml index 0bdd4df..6a187db 100644 --- a/aws/roles/moc-access/tasks/ec2.yml +++ b/aws/roles/moc-access/tasks/ec2.yml @@ -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: diff --git a/aws/roles/netstat-access/tasks/ec2.yml b/aws/roles/netstat-access/tasks/ec2.yml index 9ad584a..d47c470 100644 --- a/aws/roles/netstat-access/tasks/ec2.yml +++ b/aws/roles/netstat-access/tasks/ec2.yml @@ -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: diff --git a/aws/roles/validator-access/tasks/ec2.yml b/aws/roles/validator-access/tasks/ec2.yml index f89cef2..025cedb 100644 --- a/aws/roles/validator-access/tasks/ec2.yml +++ b/aws/roles/validator-access/tasks/ec2.yml @@ -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: diff --git a/aws/validator.yml b/aws/validator.yml index 87d7900..fc9ebb2 100644 --- a/aws/validator.yml +++ b/aws/validator.yml @@ -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 From da439b1822013e8a7ae746b4367684b5a73ee63c Mon Sep 17 00:00:00 2001 From: ArseniiPetrovich Date: Thu, 22 Nov 2018 15:00:14 +0300 Subject: [PATCH 2/3] Fix 178 issue --- aws/bootnode.yml | 5 +++-- aws/explorer.yml | 5 +++-- aws/moc.yml | 5 +++-- aws/netstat.yml | 5 +++-- aws/validator.yml | 5 +++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/aws/bootnode.yml b/aws/bootnode.yml index fe5451c..69d917d 100644 --- a/aws/bootnode.yml +++ b/aws/bootnode.yml @@ -37,16 +37,17 @@ 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 diff --git a/aws/explorer.yml b/aws/explorer.yml index d3023ca..13faa3d 100644 --- a/aws/explorer.yml +++ b/aws/explorer.yml @@ -37,16 +37,17 @@ 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 diff --git a/aws/moc.yml b/aws/moc.yml index 219eef5..155fe4e 100644 --- a/aws/moc.yml +++ b/aws/moc.yml @@ -37,16 +37,17 @@ 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 diff --git a/aws/netstat.yml b/aws/netstat.yml index 19c3767..baaadd0 100644 --- a/aws/netstat.yml +++ b/aws/netstat.yml @@ -37,16 +37,17 @@ 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 diff --git a/aws/validator.yml b/aws/validator.yml index fc9ebb2..c98fa11 100644 --- a/aws/validator.yml +++ b/aws/validator.yml @@ -37,16 +37,17 @@ 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 From 6dab34327d684be76aae4c83488b68687758b35f Mon Sep 17 00:00:00 2001 From: ArseniiPetrovich Date: Thu, 22 Nov 2018 17:09:01 +0300 Subject: [PATCH 3/3] Fix bugs after test ID counter was still hardcoded and add_host wasn't work properly --- aws/bootnode.yml | 13 ++++++------- aws/explorer.yml | 13 ++++++------- aws/moc.yml | 13 ++++++------- aws/netstat.yml | 13 ++++++------- aws/validator.yml | 13 ++++++------- 5 files changed, 30 insertions(+), 35 deletions(-) diff --git a/aws/bootnode.yml b/aws/bootnode.yml index 69d917d..78d7c1b 100644 --- a/aws/bootnode.yml +++ b/aws/bootnode.yml @@ -32,7 +32,7 @@ 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 }}" @@ -46,15 +46,14 @@ vpc_subnet_id: "{{ vpc_subnet_id }}" volumes: "{{ volumes }}" assign_public_ip: yes - with_sequence: - count: "{{ bootnode_count_instances }}" + 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 diff --git a/aws/explorer.yml b/aws/explorer.yml index 13faa3d..471784d 100644 --- a/aws/explorer.yml +++ b/aws/explorer.yml @@ -32,7 +32,7 @@ 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 }}" @@ -46,15 +46,14 @@ vpc_subnet_id: "{{ vpc_subnet_id }}" volumes: "{{ volumes }}" assign_public_ip: yes - with_sequence: - count: "{{ explorer_count_instances }}" + 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 diff --git a/aws/moc.yml b/aws/moc.yml index 155fe4e..82d37c0 100644 --- a/aws/moc.yml +++ b/aws/moc.yml @@ -32,7 +32,7 @@ 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 }}" @@ -46,15 +46,14 @@ vpc_subnet_id: "{{ vpc_subnet_id }}" volumes: "{{ volumes }}" assign_public_ip: yes - with_sequence: - count: "{{ explorer_count_instances }}" + 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 diff --git a/aws/netstat.yml b/aws/netstat.yml index baaadd0..f4d12e0 100644 --- a/aws/netstat.yml +++ b/aws/netstat.yml @@ -32,7 +32,7 @@ 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 }}" @@ -46,15 +46,14 @@ vpc_subnet_id: "{{ vpc_subnet_id }}" volumes: "{{ volumes }}" assign_public_ip: yes - with_items: - count: "{{ netstat_count_instances }}" + 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 diff --git a/aws/validator.yml b/aws/validator.yml index c98fa11..ff04ab7 100644 --- a/aws/validator.yml +++ b/aws/validator.yml @@ -32,7 +32,7 @@ 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 }}" @@ -46,15 +46,14 @@ vpc_subnet_id: "{{ vpc_subnet_id }}" volumes: "{{ volumes }}" assign_public_ip: yes - with_items: - count: "{{ validator_count_instances }}" + 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