1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
#!/usr/bin/env bash
# Configure the designate backend
# Requirements:
# Another Designate service is needed in order to install the SECONDARY zones in it.
# Enable with:
# DESIGNATE_BACKEND_DRIVER=designate
# Dependencies:
# ``functions`` file
# ``designate`` configuration
# install_designate_backend - install any external requirements
# configure_designate_backend - make configuration changes, including those to other services
# init_designate_backend - initialize databases, etc.
# start_designate_backend - start any external services
# stop_designate_backend - stop any external services
# cleanup_designate_backend - remove transient data and cache
# Save trace setting
DP_D2D_XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Defaults
# --------
# This is the Primary Designate MDNS servers.
DESIGNATE_D2D_MASTERS=${DESIGNATE_D2D_MASTERS:-""}
# DNS server to notify (MiniDNS ip:port)
DESIGNATE_D2D_ALSO_NOTIES=${DESIGNATE_D2D_ALSO_NOTIES:-""}
# DNS server to check SOA etc against
DESIGNATE_D2D_NAMESERVERS=${DESIGNATE_D2D_NAMESERVERS:-""}
DESIGNATE_D2D_AUTH_URL=${DESIGNATE_D2D_AUTH_URL:-}
DESIGNATE_D2D_USERNAME=${DESIGNATE_D2D_USERNAME:-}
DESIGNATE_D2D_PASSWORD=${DESIGNATE_D2D_PASSWORD:-}
DESIGNATE_D2D_PROJECT_NAME=${DESIGNATE_D2D_PROJECT_NAME:-}
DESIGNATE_D2D_PROJECT_DOMAIN_NAME=${DESIGNATE_D2D_PROJECT_DOMAIN_NAME:-}
DESIGNATE_D2D_USER_DOMAIN_NAME=${DESIGNATE_D2D_USER_DOMAIN_NAME:-}
DESIGNATE_D2D_REGION_NAME=${DESIGNATE_D2D_REGION_NAME:-}
# Entry Points
# ------------
# install_designate_backend - install any external requirements
function install_designate_backend {
:
}
# configure_designate_backend - make configuration changes, including those to other services
function configure_designate_backend {
iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID type designate
iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID masters $DESIGNATE_D2D_MASTERS
options="auth_url: $DESIGNATE_D2D_AUTH_URL, username: $DESIGNATE_D2D_USERNAME, password: $DESIGNATE_D2D_PASSWORD,"
options="$options project_name: $DESIGNATE_D2D_PROJECT_NAME, project_domain_name: $DESIGNATE_D2D_PROJECT_DOMAIN_NAME, user_domain_name: $DESIGNATE_D2D_USER_DOMAIN_NAME, region_name: $DESIGNATE_D2D_REGION_NAME"
iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID options "$options"
# Create a Pool Nameserver for each of the Designate nameservers
local nameserver_ids=""
IFS=',' read -a nameservers <<< "$DESIGNATE_D2D_NAMESERVERS"
for nameserver in "${nameservers[@]}"; do
local nameserver_id
nameserver_id=`uuidgen`
iniset $DESIGNATE_CONF pool_nameserver:$nameserver_id host $(dig +short A $nameserver | head -n 1)
iniset $DESIGNATE_CONF pool_nameserver:$nameserver_id port 53
# Append the Nameserver ID to the list
nameserver_ids+=${nameserver_id},
done
# Configure the Pool for the set of nameserver IDs, minus the trailing comma
iniset $DESIGNATE_CONF pool:$DESIGNATE_POOL_ID nameservers "${nameserver_ids:0:-1}"
# Configure the Pool to Notify the destination Mdns
iniset $DESIGNATE_CONF pool:$DESIGNATE_POOL_ID also_notifies "$DESIGNATE_D2D_ALSO_NOTIFIES"
}
# create_designate_ns_records - Create Pool NS Records
function create_designate_ns_records_backend {
# Build an array of the Designate nameservers.
IFS=',' read -a ns_records <<< "$DESIGNATE_D2D_NAMESERVERS"
# Create a NS Record for each of the Designate nameservers
for ns_record in "${ns_records[@]}"; do
designate server-create --name "${ns_record%%.}."
done
}
# init_designate_backend - initialize databases, etc.
function init_designate_backend {
:
}
# start_designate_backend - start any external services
function start_designate_backend {
:
}
# stop_designate_backend - stop any external services
function stop_designate_backend {
:
}
# cleanup_designate_backend - remove transient data and cache
function cleanup_designate_backend {
:
}
# Restore xtrace
$DP_D2D_XTRACE
|