From a423826fcdcff0ff72dca2bdbb5ca75759359eea Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sun, 16 Mar 2025 16:34:38 -0500 Subject: [PATCH] newvm: Add host to some groups by default There are some groups that all hosts should belong to in almost all cases. Rather than have to remember to add the `--group` arguments for each of these, the `newvm.sh` script will now enable them by default. For hosts that should _not_ belong to (at least one of) these groups, the `--no-default-groups` argument can be provided to suppress that behavior. The default groups, initially, are _chrony_ and _collectd_. --- newvm.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/newvm.sh b/newvm.sh index 89854ef..3724cb7 100755 --- a/newvm.sh +++ b/newvm.sh @@ -8,9 +8,10 @@ vcpus=2 disk_size=16 kickstart=https://git.pyrocufflink.net/infra/kickstart/raw/branch/master/fedora.ks fedora=$(rpm -E %fedora) -network=network=prod -dnsdomain=pyrocufflink.blue +network=network=kube +dnsdomain=host.pyrocufflink.black console=true +default_groups=true usage() { printf 'usage: %s [options] name\n' "${0##*/}" @@ -89,6 +90,9 @@ while [ $# -gt 0 ]; do --group=*) groups_xml="${groups_xml}" ;; + --no-default-groups) + default_groups=false; + ;; --no-console|--noconsole) console=false ;; @@ -129,6 +133,11 @@ if [ -z "${LIBVIRT_DEFAULT_URI}" ]; then exit 1 fi +if ${default_groups}; then + groups_xml="${groups_xml}" + groups_xml="${groups_xml}" +fi + printf 'Creating %s on %s\n' "${name}" "${LIBVIRT_DEFAULT_URI}" if [ -z "${location}" ]; then