made the vm host id parameter based on just created vm host

This commit is contained in:
Anton Smith 2021-11-16 17:13:51 +01:00
parent c1425e8dce
commit 7361f32f1c

View File

@ -35,12 +35,12 @@ maas admin subnet update $SUBNET gateway_ip=10.10.10.1
maas admin ipranges create type=dynamic start_ip=10.10.10.200 end_ip=10.10.10.254 maas admin ipranges create type=dynamic start_ip=10.10.10.200 end_ip=10.10.10.254
maas admin vlan update $FABRIC_ID $VLAN_TAG dhcp_on=True primary_rack=$PRIMARY_RACK maas admin vlan update $FABRIC_ID $VLAN_TAG dhcp_on=True primary_rack=$PRIMARY_RACK
maas admin maas set-config name=upstream_dns value=8.8.8.8 maas admin maas set-config name=upstream_dns value=8.8.8.8
# Add LXD as a VM host for MAAS # Add LXD as a VM host for MAAS and capture the VM_HOST_ID
maas admin vm-hosts create password=password type=lxd power_address=https://${IP_ADDRESS}:8443 project=maas VM_HOST_ID=maas admin vm-hosts create password=password type=lxd power_address=https://${IP_ADDRESS}:8443 \
project=maas | jq '.id'
### creating VMs for Juju controller and our "bare metal" ### creating VMs for Juju controller and our "bare metal"
export VM_HOST_ID=maas admin vm-hosts read | jq -r --arg VM_HOST "$(hostname)" '.[] | select (.name==$VM_HOST) | .id'
# add a VM for the juju controller with minimal memory # 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" # get the system-id and tag the machine with "juju-controller"