Last active
February 12, 2018 16:58
-
-
Save ThinGuy/a0053bf0d0467cf8c7745116bacca9c7 to your computer and use it in GitHub Desktop.
Using MaaS automatic tagging features and assign kernel options those machines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[ ${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