Update 'maas-setup.sh'

This commit is contained in:
Adolfo Delorenzo 2022-10-26 19:52:07 +00:00
parent d35d4686e5
commit 12c24c418f
1 changed files with 16 additions and 10 deletions

View File

@ -7,6 +7,12 @@
# Note: this tutorial has not been tested on versions prior to 20.04.
# lxd / maas issue. either upgrade lxd or maas to 3.1
useradd -s /bin/bash -d /home/maas -m maas
echo "maas ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/maas
su - maas
sudo snap install --channel=latest/stable lxd
sudo snap refresh --channel=latest/stable lxd
sudo snap install jq
@ -67,19 +73,19 @@ maas admin tags create name=metal comment='This tag should to machines that will
### creating VMs for Juju controller and our "bare metal"
# add a VM for the juju controller with minimal memory
maas admin vm-host compose $VM_HOST_ID cores=8 memory=2048 architecture="amd64/generic" \
storage="main:16(pool1)" hostname="juju-controller"
#maas admin vm-host compose $VM_HOST_ID cores=8 memory=2048 architecture="amd64/generic" \
# storage="main:16(pool1)" hostname="juju-controller"
# get the system-id and tag the machine with "juju-controller"
export JUJU_SYSID=$(maas admin machines read | jq '.[]
| select(."hostname"=="juju-controller")
| .["system_id"]' | tr -d '"')
maas admin tag update-nodes "juju-controller" add=$JUJU_SYSID
#export JUJU_SYSID=$(maas admin machines read | jq '.[]
#| select(."hostname"=="juju-controller")
#| .["system_id"]' | tr -d '"')
#maas admin tag update-nodes "juju-controller" add=$JUJU_SYSID
## Create 3 "bare metal" machines and tag them with "metal"
for ID in 1 2 3
# Create 3 "bare metal" machines and tag them with "metal"
for ID in {00..49}
do
maas admin vm-host compose $VM_HOST_ID cores=8 memory=8192 architecture="amd64/generic" \
storage="main:25(pool1),ceph:100(pool1)" hostname="metal-${ID}"
maas admin vm-host compose $VM_HOST_ID cores=1 memory=1024 architecture="amd64/generic" \
storage="main:25(pool1)" hostname="metal-${ID}"
SYSID=$(maas admin machines read | jq -r --arg MACHINE "metal-${ID}" '.[]
| select(."hostname"==$MACHINE)
| .["system_id"]' | tr -d '"')