newvm: Add domain argument
Now that we have multiple domains (_pyrocufflink.blue_ for AD domain members and _pyrocufflink.black_ for the new machines), we need a way to specify the domain for new machines when they are created. Thus, the `newvm.sh` script accepts either an FQDN or a `--domain` argument. The DHCP server will register the DNS name in the zone containing the machine's domain name.dynamic-inventory
parent
7a5f01f8a3
commit
e41b6a619e
20
newvm.sh
20
newvm.sh
|
@ -7,6 +7,7 @@ disk_size=16
|
||||||
kickstart=http://rosalina.pyrocufflink.blue/~dustin/kickstart/fedora.ks
|
kickstart=http://rosalina.pyrocufflink.blue/~dustin/kickstart/fedora.ks
|
||||||
fedora=$(rpm -E %fedora)
|
fedora=$(rpm -E %fedora)
|
||||||
network=network=prod
|
network=network=prod
|
||||||
|
dnsdomain=pyrocufflink.blue
|
||||||
console=true
|
console=true
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
|
@ -65,6 +66,13 @@ while [ $# -gt 0 ]; do
|
||||||
--network=*)
|
--network=*)
|
||||||
network="${1#*=}"
|
network="${1#*=}"
|
||||||
;;
|
;;
|
||||||
|
--domain)
|
||||||
|
shift
|
||||||
|
dnsdomain=$1
|
||||||
|
;;
|
||||||
|
--domain=*)
|
||||||
|
dnsdomain=${1#=*}
|
||||||
|
;;
|
||||||
--no-console|--noconsole)
|
--no-console|--noconsole)
|
||||||
console=false
|
console=false
|
||||||
;;
|
;;
|
||||||
|
@ -88,6 +96,16 @@ if [ -z "${name}" ]; then
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case ${name} in
|
||||||
|
*.*)
|
||||||
|
hostname=${name}
|
||||||
|
name=${name%%.*}
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
hostname=${name}.${dnsdomain}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ -z "${LIBVIRT_DEFAULT_URI}" ]; then
|
if [ -z "${LIBVIRT_DEFAULT_URI}" ]; then
|
||||||
printf 'LIBVIRT_DEFAULT_URI is not set.\n' >&2
|
printf 'LIBVIRT_DEFAULT_URI is not set.\n' >&2
|
||||||
printf 'If you want to create a new VM locally, explicitly set '
|
printf 'If you want to create a new VM locally, explicitly set '
|
||||||
|
@ -110,7 +128,7 @@ else
|
||||||
printf 'Using HTTP proxy: %s\n' "${http_proxy}" >&2
|
printf 'Using HTTP proxy: %s\n' "${http_proxy}" >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
extra_args="ip=::::${name}::dhcp inst.ks=${kickstart}"
|
extra_args="ip=::::${hostname}::dhcp inst.ks=${kickstart}"
|
||||||
if [ -n "${http_proxy}" ]; then
|
if [ -n "${http_proxy}" ]; then
|
||||||
extra_args="${extra_args} inst.proxy=${http_proxy}"
|
extra_args="${extra_args} inst.proxy=${http_proxy}"
|
||||||
if [ ${fedora} -lt 40 ]; then
|
if [ ${fedora} -lt 40 ]; then
|
||||||
|
|
Loading…
Reference in New Issue