From 57019f605a3e99e31e5574dbab2346ce3d748665 Mon Sep 17 00:00:00 2001 From: Marcel Mamula Date: Mon, 12 Aug 2024 15:13:33 +0200 Subject: [PATCH] feat: Add optional AWS DNS overwrite --- roles/sap_vm_provision/defaults/main.yml | 3 +++ .../tasks/platform_ansible/aws_ec2_vs/execute_main.yml | 1 + .../tasks/platform_ansible/aws_ec2_vs/execute_setup_ha.yml | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/roles/sap_vm_provision/defaults/main.yml b/roles/sap_vm_provision/defaults/main.yml index f2fba42..8612c8f 100644 --- a/roles/sap_vm_provision/defaults/main.yml +++ b/roles/sap_vm_provision/defaults/main.yml @@ -145,6 +145,9 @@ sap_vm_provision_aws_placement_strategy_spread: false # Example for HANA HA: "HA-Role-Pacemaker-{{ sap_system_hana_db_sid }}" sap_vm_provision_aws_ha_iam_role: "HA-Role-Pacemaker" sap_vm_provision_aws_ha_iam_instance_profile: "HA-Instance-Profile-Pacemaker-Cluster" +# Enable to overwrite existing DNS record. +# AWS Route53 module fails when DNS record already exists. +sap_vm_provision_aws_dns_overwrite: false # Google Cloud sap_vm_provision_gcp_credentials_json: "" diff --git a/roles/sap_vm_provision/tasks/platform_ansible/aws_ec2_vs/execute_main.yml b/roles/sap_vm_provision/tasks/platform_ansible/aws_ec2_vs/execute_main.yml index 56155c6..bcbeced 100644 --- a/roles/sap_vm_provision/tasks/platform_ansible/aws_ec2_vs/execute_main.yml +++ b/roles/sap_vm_provision/tasks/platform_ansible/aws_ec2_vs/execute_main.yml @@ -103,6 +103,7 @@ wait: true access_key: "{{ sap_vm_provision_aws_access_key }}" secret_key: "{{ sap_vm_provision_aws_secret_access_key }}" + overwrite: "{{ sap_vm_provision_aws_dns_overwrite if sap_vm_provision_aws_dns_overwrite | bool else false }}" rescue: # This requires no_log set on each Ansible Task, and not set on the Ansible Task Block diff --git a/roles/sap_vm_provision/tasks/platform_ansible/aws_ec2_vs/execute_setup_ha.yml b/roles/sap_vm_provision/tasks/platform_ansible/aws_ec2_vs/execute_setup_ha.yml index 5c0e4a2..18e5c58 100644 --- a/roles/sap_vm_provision/tasks/platform_ansible/aws_ec2_vs/execute_setup_ha.yml +++ b/roles/sap_vm_provision/tasks/platform_ansible/aws_ec2_vs/execute_setup_ha.yml @@ -51,6 +51,7 @@ wait: true access_key: "{{ sap_vm_provision_aws_access_key }}" secret_key: "{{ sap_vm_provision_aws_secret_access_key }}" + overwrite: "{{ sap_vm_provision_aws_dns_overwrite if sap_vm_provision_aws_dns_overwrite | bool else false }}" loop: "{{ (groups['hana_primary'] | default([])) }}" loop_control: loop_var: host_node @@ -92,6 +93,7 @@ wait: true access_key: "{{ sap_vm_provision_aws_access_key }}" secret_key: "{{ sap_vm_provision_aws_secret_access_key }}" + overwrite: "{{ sap_vm_provision_aws_dns_overwrite if sap_vm_provision_aws_dns_overwrite | bool else false }}" loop: "{{ (groups['anydb_primary'] | default([])) }}" loop_control: loop_var: host_node @@ -133,6 +135,7 @@ wait: true access_key: "{{ sap_vm_provision_aws_access_key }}" secret_key: "{{ sap_vm_provision_aws_secret_access_key }}" + overwrite: "{{ sap_vm_provision_aws_dns_overwrite if sap_vm_provision_aws_dns_overwrite | bool else false }}" loop: "{{ (groups['nwas_ascs'] | default([])) }}" loop_control: loop_var: host_node @@ -174,6 +177,7 @@ wait: true access_key: "{{ sap_vm_provision_aws_access_key }}" secret_key: "{{ sap_vm_provision_aws_secret_access_key }}" + overwrite: "{{ sap_vm_provision_aws_dns_overwrite if sap_vm_provision_aws_dns_overwrite | bool else false }}" loop: "{{ (groups['nwas_ers'] | default([])) }}" loop_control: loop_var: host_node