Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5071736
Merge pull request #2654 from codeenigma/Gitlab-stop-fix-PR-2.x
drazenCE Sep 2, 2025
a8ba8e4
Fixing-email-title-for-backup-validation (#2657)
matej5 Sep 4, 2025
057138d
Adding-task-to-create-aurora-cluster (#2659)
matej5 Sep 8, 2025
2b30a78
Fixing truthy variable mistakes. (#2662)
gregharvey Sep 10, 2025
cb63668
feat(php): Add FPM slow logrotate (#2625)
klausi Sep 10, 2025
9f05b90
r73458-install-php-gmp-by-default2 (#2667)
nfawbert Sep 10, 2025
a89ae45
Wazuh-mitre-report-setup (#2588)
drazenCE Sep 11, 2025
71278e9
Wazuh mitre report setup pr 2.x (#2669)
drazenCE Sep 11, 2025
65a6a0d
pin_ansible_version (#2671)
tymofiisobchenko Sep 12, 2025
854a245
Fixing-ce-provision-vars (#2678)
drazenCE Sep 16, 2025
9cfef8e
Added-tasks-to-backup-Aurora-and-copy-AMI-to-safe-region
Sep 16, 2025
0e6e395
Resolving-conflicts
Sep 16, 2025
1a320e5
Reverting-wazuh-tasks
Sep 16, 2025
1b9cf13
Fixing-aurora-backup-tasks
Sep 16, 2025
0c251b1
Merge branch 'Adding-Aurora-to-backup-plan-and-restore-testing' into …
Sep 16, 2025
0a80757
Fixing-aurora-backup-tasks-2
Sep 16, 2025
692b20e
Merge branch 'Adding-Aurora-to-backup-plan-and-restore-testing' into …
Sep 16, 2025
ee26695
Fixing-aurora-backup-tasks-3
Sep 16, 2025
be01523
Merge branch 'Adding-Aurora-to-backup-plan-and-restore-testing' into …
Sep 16, 2025
df86dab
Fixing-aurora-backup-tasks-4
Sep 16, 2025
1c7fd06
Fixing-aurora-backup-tasks-5
Sep 16, 2025
8ac74be
Updating-aurora-vars
Sep 16, 2025
fdfb01b
Merge branch 'Adding-Aurora-to-backup-plan-and-restore-testing' into …
Sep 16, 2025
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
3 changes: 2 additions & 1 deletion roles/aws/aws_backup/tasks/resource.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@
instance: "ec2"
file-system: "elasticfilesystem"
db: "rds"
cluster: "rds"
ansible.builtin.set_fact:
_resource_arn: "arn:aws:{{ arn_construct[backup.resource_type] }}:{{ _aws_region }}:{{ caller_info.account }}:{{ backup.resource_type }}{% if backup.resource_type == 'db' %}:{% else %}/{% endif %}{{ backup.resource_id }}"
_resource_arn: "arn:aws:{{ arn_construct[backup.resource_type] }}:{{ _aws_region }}:{{ caller_info.account }}:{{ backup.resource_type }}{% if backup.resource_type == 'db' or backup.resource_type == 'cluster' %}:{% else %}/{% endif %}{{ backup.resource_id }}"

- name: Check if the resource selection exists.
ansible.builtin.command: >
Expand Down
17 changes: 5 additions & 12 deletions roles/aws/aws_backup_validation/tasks/testing_resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,33 +68,26 @@
instance: "EC2"
file-system: "EFS"
db: "RDS"
cluster: "AURORA"

- name: Set instance type for template.
ansible.builtin.set_fact:
_instance_type_restore: "{{ instance_type[backup.resource_type] }}"
_template_prefix: "{{ instance_type[backup.resource_type] }}"
when: backup.resource_type != 'file-system'

- name: Set instance type to Aurora if defined.
ansible.builtin.set_fact:
_instance_type_restore: "Aurora"
when:
- backup.resource_type == 'db'
- "'aurora' in aws_rds.engine"

- name: Create restore testing query file.
ansible.builtin.template:
src: "{{ _template_prefix }}_restore_testing.j2"
src: "{{ _instance_type_restore }}_restore_testing.j2"
dest: /tmp/restore_testing.json
register: _restore_testing_query
when: _template_prefix is defined
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 }}
register: _protected_res

- name: Assign {{ _template_prefix }} resource to AWS restore testing plan.
- name: Assign {{ _instance_type_restore }} 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: _template_prefix is defined and _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
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"RestoreTestingPlanName": "{{ _testing_plan_info.stdout | from_json | json_query("RestoreTestingPlanName") }}",
"RestoreTestingSelection": {
"IamRoleArn": "{{ _default_backup_role_arn.iam_roles[0].arn }}",
"ProtectedResourceArns": [
"{{ _resource_arn }}"
],
"ProtectedResourceType": "{{ _instance_type_restore }}",
"RestoreMetadataOverrides": {
"vpcSecurityGroupIds": "[\"{{ _restore_testing_sg.group_id }}\"]",
"dbsubnetgroupname": "{{ aws_rds.name }}"
},
"RestoreTestingSelectionName": "{{ backup.selection_name | replace("-", "_") }}",
"ValidationWindowHours": 1
}
}
7 changes: 7 additions & 0 deletions roles/aws/aws_ec2_autoscale_cluster/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -778,3 +778,10 @@
when:
- aws_ec2_autoscale_cluster.route_53.zone is defined
- aws_ec2_autoscale_cluster.route_53.zone | length > 0

- name: Copy AMI to backup region.
community.aws.ec2_ami_copy:
aws_profile: "{{ aws_ec2_autoscale_cluster.aws_profile }}"
source_region: "{{ aws_ec2_autoscale_cluster.region }}"
region: "{{ aws_backup.copy_vault.region }}"
source_image_id: "{{ aws_ec2_autoscale_cluster_image_latest }}"
15 changes: 15 additions & 0 deletions roles/aws/aws_rds/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,18 @@
- aws_rds.backup is defined
- aws_rds.backup | length > 0
- "'aurora' not in aws_rds.engine"

- name: Assign Aurora resource to backup plan.
ansible.builtin.include_role:
name: aws/aws_backup
tasks_from: resource
vars:
backup:
backup_plan_name: "{{ aws_rds.backup }}"
selection_name: "AURORA-{{ aws_rds.name }}-{{ _env_type }}"
resource_id: "{{ aws_rds.name }}"
resource_type: "cluster"
when:
- aws_rds.backup is defined
- aws_rds.backup | length > 0
- "'aurora' in aws_rds.engine"