Skip to content

Commit

Permalink
Matching-2.x-and-devel-branches (#1999)
Browse files Browse the repository at this point in the history
Co-authored-by: Matej Stajduhar <[email protected]>
  • Loading branch information
matej5 and Matej Stajduhar authored Oct 2, 2024
1 parent 7733709 commit c7cc767
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions roles/aws/aws_backup_validation/tasks/testing_resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,32 @@

- name: Construct AWS instance type.
vars:
_instance_type:
instance_type:
instance: "EC2"
file-system: "EFS"
db: "RDS"
ansible.builtin.set_fact:
_instance_type_restore: "{{ _instance_type[backup.resource_type] }}"
_instance_type_restore: "{{ instance_type[backup.resource_type] }}"
when: backup.resource_type != 'file-system'

- name: Print previous variable
ansible.builtin.debug:
var: instance_type

- name: Print previous variable
ansible.builtin.debug:
var: _instance_type_restore

- name: Create restore testing query file.
ansible.builtin.template:
src: restore_testing.j2
dest: /tmp/restore_testing.json
register: _restore_testing_query
when: _instance_type_restore is defined

- name: Check if protected reource exist
ansible.builtin.command: >
aws backup list-protected-resources --query "Results[?ResourceArn=='{{ _resource_arn }}']" --region {{ _aws_region }}
aws backup list-protected-resources --query "Results[?ResourceArn=='{{ _resource_arn }}']" --region {{ _aws_region }}
register: _protected_res

- name: Print previous variable
Expand All @@ -82,4 +92,4 @@
- name: Assign EC2 resource to AWS restore testing plan.
ansible.builtin.command: >
aws backup create-restore-testing-selection --cli-input-json file:///tmp/restore_testing.json --region {{ _aws_region }}
when: _testing_plan_info.stdout != "null" and _testing_selection_exists.stdout | length == 0 and _protected_res.stdout | length != 0
when: _instance_type_restore is defined and _testing_plan_info.stdout != "null" and _testing_selection_exists.stdout | length == 0 and _protected_res.stdout | length != 0

0 comments on commit c7cc767

Please sign in to comment.