Run delete before adding A records in plans

This commit is contained in:
moeny-matt 2025-05-15 17:52:02 -04:00
parent 2e4572c1d3
commit 755f6e938e
4 changed files with 52 additions and 0 deletions

View File

@ -205,6 +205,15 @@ steps:
nameserver3: $nameserver3
staging_ip: $staging_ip
- name: delete_dns_a_record
description: Delete existing DNS A record for the VM if it exists
task: common::delete_dns_a_record
targets: localhost
parameters:
network: $network
add_a_record_bool: $add_a_record_bool
dns_hostname: $dns_hostname
- name: add_dns_a_record
description: Add a DNS A record for the VM
task: common::add_dns_a_record
@ -216,6 +225,15 @@ steps:
dns_hostname: $dns_hostname
dns_ttl: $dns_ttl
- name: delete_dns_a_record_internal
description: Delete existing internal DNS A record for the VM if it exists
task: common::delete_dns_a_record_internal
targets: localhost
parameters:
network: $network
add_a_record_bool: $add_a_record_bool
dns_hostname: $dns_hostname
- name: add_dns_a_record_internal
description: Add an Internal DNS A record for the VM
task: common::add_dns_a_record_internal

View File

@ -1,8 +1,16 @@
#!/bin/bash
# This script deletes a DNS A record from the DNS server zone file (common::delete_dns_a_record)
# Bolt environment variables
NETWORK="${PT_network}"
ADD_A_RECORD="${PT_add_a_record_bool}"
HOSTNAME="${PT_dns_hostname}"
# Check if we should add DNS record based on network and add_a_record_bool
if [ "$ADD_A_RECORD" != "true" ] || [ "$NETWORK" != "wan-verizon" ]; then
echo '{"status": "skipped", "message": "Skipping public facing DNS A record deletion based on configuration"}'
exit 0
fi
# Check if required parameters are provided
if [ -z "$HOSTNAME" ]; then
echo '{"status": "failure", "message": "Error: dns_hostname parameter must be provided"}'

View File

@ -1,8 +1,16 @@
#!/bin/bash
# This script deletes a DNS A record from the DNS server zone file (common::delete_dns_a_record_internal)
# Bolt environment variables
NETWORK="${PT_network}"
ADD_A_RECORD="${PT_add_a_record_bool}"
HOSTNAME="${PT_dns_hostname}"
# Check if we should add DNS record based on network and add_a_record_bool
if [ "$ADD_A_RECORD" != "true" ] || [ "$NETWORK" != "internal-moeny" ]; then
echo '{"status": "skipped", "message": "Skipping internal DNS A record deletion based on configuration"}'
exit 0
fi
# Check if required parameters are provided
if [ -z "$HOSTNAME" ]; then
echo '{"status": "failure", "message": "Error: dns_hostname parameter must be provided"}'

View File

@ -181,6 +181,15 @@ steps:
nameserver2: $nameserver2
nameserver3: $nameserver3
- name: delete_dns_a_record
description: Delete existing DNS A record for the VM if it exists
task: common::delete_dns_a_record
targets: localhost
parameters:
network: $network
add_a_record_bool: $add_a_record_bool
dns_hostname: $dns_hostname
- name: add_dns_a_record
description: Add a DNS A record for the VM
task: common::add_dns_a_record
@ -192,6 +201,15 @@ steps:
dns_hostname: $dns_hostname
dns_ttl: $dns_ttl
- name: delete_dns_a_record_internal
description: Delete existing internal DNS A record for the VM if it exists
task: common::delete_dns_a_record_internal
targets: localhost
parameters:
network: $network
add_a_record_bool: $add_a_record_bool
dns_hostname: $dns_hostname
- name: add_dns_a_record_internal
description: Add an Internal DNS A record for the VM
task: common::add_dns_a_record_internal