Skip to content

Commit

Permalink
Addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
GomathiselviS committed Oct 23, 2023
1 parent cb6457f commit fe49153
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 25 deletions.
2 changes: 1 addition & 1 deletion playbooks/webapp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ To delete the webapp:

`webapp_ha_aurora.yaml` playbook deploys the flask app to a cross region high availability architecture. The playbook replicates the app deployment to a second region. The backend is an Aurora global cluster. For adding the write forwarding feature, aurora-mysql can be used. Default db engine is aurora-postgresql. The app in each region is configured to access the associated Aurora cluster. In front of the two regions, route53 records are added to provide cross region DNS (failover scenario).

Along with the above variables, following variables are need for this playbook:
Along with the [above](https://github.com/redhat-cop/cloud.aws_ops/blob/main/playbooks/webapp/README.md#playbook-variables) variables, following variables are needed for this playbook:

* **rds_instance_class** (str): DB instance class for the aurora db instances. Default: `db.r5.large`
* **rds_global_cluster_name** (str): Name of the global cluster. Default: "{{ resource_prefix }}-global-cluster"
Expand Down
6 changes: 0 additions & 6 deletions playbooks/webapp/migrate_webapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
vars:
rds_snapshot_arn: "{{ result.db_snapshot_arn }}"
region: "{{ dest_region }}"
bastion_host_type: t3.micro
deploy_flask_app_workers_instance_type: t3.micro

- name: Deploy app
when: operation == "create"
Expand All @@ -65,7 +63,6 @@
deploy_flask_app_vm_info: "{{ vm_result }}"
deploy_flask_app_rds_info: "{{ rds_result }}"
deploy_flask_app_region: "{{ dest_region }}"
deploy_flask_app_workers_instance_type: t3.micro

- name: Delete RDS snapshots from different regions
amazon.aws.rds_instance_snapshot:
Expand All @@ -79,7 +76,4 @@

- name: Delete instance from source region
ansible.builtin.import_tasks: tasks/delete.yaml
vars:
bastion_host_type: t3.micro
deploy_flask_app_workers_instance_type: t3.micro
when: delete_source | default(false) | bool
6 changes: 0 additions & 6 deletions playbooks/webapp/tasks/delete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
amazon.aws.rds_subnet_group:
name: "{{ rds_subnet_group_name }}"
state: absent
ignore_errors: true

- name: List Security group from VPC
amazon.aws.ec2_security_group_info:
Expand Down Expand Up @@ -115,7 +114,6 @@
lookup: id
state: absent
with_items: "{{ route_table.route_tables | map(attribute='id') | list }}"
ignore_errors: true

- name: Get NAT gateway
amazon.aws.ec2_vpc_nat_gateway_info:
Expand All @@ -129,21 +127,18 @@
state: absent
wait: true
with_items: "{{ nat_gw.result | map(attribute='nat_gateway_id') | list }}"
ignore_errors: true

- name: Delete internet gateway
amazon.aws.ec2_vpc_igw:
vpc_id: "{{ vpc_id }}"
state: absent
ignore_errors: true

- name: Delete subnets
amazon.aws.ec2_vpc_subnet:
cidr: "{{ item }}"
state: absent
vpc_id: "{{ vpc_id }}"
with_items: "{{ subnet_cidr }}"
ignore_errors: true

# As ec2_vpc_route_table can't delete route table, the vpc still has dependencies and cannot be deleted.
# You need to do it delete it manually using either the console or the cli.
Expand All @@ -152,4 +147,3 @@
name: "{{ vpc_name }}"
cidr_block: "{{ vpc_cidr }}"
state: absent
ignore_errors: true
3 changes: 0 additions & 3 deletions playbooks/webapp/tasks/delete_route53_records.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
- item.health_check_config.type == 'HTTP'
- item.health_check_config.fully_qualified_domain_name | regex_search('.*elb.amazonaws.com')
loop: "{{ health_check_info.health_checks }}"
ignore_errors: True

- name: Get hosted zone details
amazon.aws.route53_info:
Expand Down Expand Up @@ -50,7 +49,6 @@
alias: True
alias_hosted_zone_id: "{{ item.alias_target.hosted_zone_id }}"
value: "{{ item.alias_target.dns_name[:-1] }}"
ignore_errors: True
when:
- item.set_identifier is defined
- item.set_identifier == "primary-record"
Expand All @@ -67,7 +65,6 @@
failover: "SECONDARY"
alias_hosted_zone_id: "{{ item.alias_target.hosted_zone_id }}"
value: "{{ item.alias_target.dns_name[:-1] }}"
ignore_errors: True
when:
- item.set_identifier is defined
- item.set_identifier == "replica-record"
Expand Down
2 changes: 1 addition & 1 deletion playbooks/webapp/vars/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ deploy_flask_app_bastion_host_required_packages:
- podman
- httpd-tools
- ansible-core
deploy_flask_app_workers_instance_type: t3.micro
deploy_flask_app_workers_instance_type: t2.xlarge
deploy_flask_app_workers_user_name: fedora
deploy_flask_app_number_of_workers: 2
deploy_flask_app_listening_port: 5000
Expand Down
4 changes: 0 additions & 4 deletions playbooks/webapp/webapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@

- name: Run operation create/delete
ansible.builtin.import_tasks: tasks/{{ operation }}.yaml
vars:
bastion_host_type: t3.micro
deploy_flask_app_workers_instance_type: t3.micro

- name: Deploy Flask App
hosts: localhost
Expand All @@ -33,4 +30,3 @@
deploy_flask_app_vpc_id: "{{ vpc.vpc.id }}"
deploy_flask_app_vm_info: "{{ vm_result }}"
deploy_flask_app_rds_info: "{{ rds_result }}"
deploy_flask_app_workers_instance_type: t3.micro
4 changes: 0 additions & 4 deletions playbooks/webapp/webapp_ha_aurora.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
region: "{{ creation_region }}"
rds_instance_class: db.r5.large
rds_engine: aurora-postgresql
bastion_host_type: t3.micro
deploy_flask_app_workers_instance_type: t3.micro
loop:
- "{{ rds_primary_cluster_region }}"
- "{{ rds_replica_cluster_region }}"
Expand Down Expand Up @@ -59,7 +57,6 @@
ansible.builtin.include_role:
name: cloud.aws_ops.deploy_flask_app
vars:
deploy_flask_app_workers_instance_type: t3.micro
deploy_flask_app_private_subnet_id: "{{ primary_private_subnet.subnets[0].id }}"
deploy_flask_app_vpc_id: "{{ primary_vpc.vpcs[0].id }}"
deploy_flask_app_vm_info: "{{ primary_vm_result }}"
Expand Down Expand Up @@ -99,7 +96,6 @@
ansible.builtin.include_role:
name: cloud.aws_ops.deploy_flask_app
vars:
deploy_flask_app_workers_instance_type: t3.micro
deploy_flask_app_private_subnet_id: "{{ replica_private_subnet.subnets[0].id }}"
deploy_flask_app_vpc_id: "{{ replica_vpc.vpcs[0].id }}"
deploy_flask_app_vm_info: "{{ replica_vm_result }}"
Expand Down

0 comments on commit fe49153

Please sign in to comment.