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

Matching-2.x-and-devel-branches #1999

Merged
merged 1 commit into from
Oct 2, 2024
Merged
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
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
Loading