Skip to content

Instantly share code, notes, and snippets.

@apowers313
Created April 17, 2023 04:46
Show Gist options
  • Save apowers313/ab8ac0206cb95386a54568bd0d51e88c to your computer and use it in GitHub Desktop.
Save apowers313/ab8ac0206cb95386a54568bd0d51e88c to your computer and use it in GitHub Desktop.
Setup.a new machine on MAAS
#!/bin/bash
# list all hosts
maas admin machines read | grep hostname
# find hosts by status
maas admin machines read status=new | grep hostname
# (new, commissioning, ready)
# find machine
# maas admin machines read mac_address="fa:7b:af:c6:51:ea"
# maas admin machines read hostname=k8s-baby1
# maas admin machines read status=new | grep hostname
# set hostname
HOSTNAME=k8s-baby1
# find system ID
SYSTEM_ID=`maas admin machines read hostname=$HOSTNAME | grep system_id | head -1 | cut -d\" -f4`
# rename machine
maas admin machine update $SYSTEM_ID hostname=k8s-baby1
# HOSTNAME=...
# configure power
PROXMOX_PASS=XXXX
maas admin machine update $SYSTEM_ID power_type=proxmox power_parameters_power_address=10.253.0.1 power_parameters_power_user=root@pam power_parameters_power_pass=$PROXMOX_PASS power_parameters_power_vm_name=$HOSTNAME power_parameters_power_verify_ssl=n
maas admin machine power-parameters $SYSTEM_ID
# commission
maas admin machine commission $SYSTEM_ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment