Skip to content

Instantly share code, notes, and snippets.

@ThinGuy
Last active February 12, 2018 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThinGuy/a0053bf0d0467cf8c7745116bacca9c7 to your computer and use it in GitHub Desktop.
Save ThinGuy/a0053bf0d0467cf8c7745116bacca9c7 to your computer and use it in GitHub Desktop.
Using MaaS automatic tagging features and assign kernel options those machines
[[ ${MAAS_PROFILE} ]] || MAAS_PROFILE=$(maas 2>/dev/null list|awk '{print $1}')
if [[ -z ${MAAS_PROFILE} ]];then
printf "Cannot determine MaaS profile name. Please log in to maas from the command line.\n\n"
#if being called from a function, return
[[ $0 = bash ]] && return 1
#if being called from a script, exit
[[ -f $0 ]] && exit 1
else
#Automatically tag KVM machines and set console to ttys0 so virsh console works
maas ${MAAS_PROFILE} tags create name=virtual \
comment="xpath tag to automatically identify KVM Machines" \
definition='//node[@class="system"]/vendor = "QEMU"' \
kernel_opts='console=tty0 console=ttyS0'
#Automatically tag NUCs and set console to ttyS4 so amtterm works
#Use old style NIC names and set clocksource to kvm
maas ${MAAS_PROFILE} tags create name=NUC \
comment="xpath tag to automatically identify Intel NUCs" \
definition='contains(//node[@id="core" and @class="bus" and @handle="DMI:0002"]/product,"NUC")' \
kernel_opts='net.ifnames=0 console=tty0 console=ttyS0,115200n8 console=ttyS4,115200n8 clocksource=kvm-clock'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment