Skip to content

Instantly share code, notes, and snippets.

@ThinGuy
Created December 4, 2024 22:53
Show Gist options
  • Save ThinGuy/8c40b5cc19ab2b5e3eba65aaf8ace874 to your computer and use it in GitHub Desktop.
Save ThinGuy/8c40b5cc19ab2b5e3eba65aaf8ace874 to your computer and use it in GitHub Desktop.
How to grab MAAS boot and deployment files
### **Variables**
export RACK=<MAAS_RACK_IP>
export REGION=<MAAS_REGION_IP>
### **Boot Files**
```
curl -sSlL http://$RACK:5248/images/|awk -F'>|<' '/^<a href/{print $3,$5}'
``
### Test pulling static file via tftp (requires install tftp-hpa package)**
```
tftp -m binary $RACK -c get <filename from above>
```
Ex. `tftp -m binary $RACK -c get maas.meta`
## **Test pulling static file via http**
```
curl -sSlL -o <filename from above> http://$RACK:5248/images/<filename from above>
```
Ex. `curl -sSlL -o maas.meta http://$RACK:5248/images/maas.meta`
Ex. `curl -sSlL http://$RACK:5248/images/maas.meta`
Ex. `curl -sSlL http://$RACK:5248/images/maas.meta|jq -r`
### **Static PXELinux i386, AMD64**
`tftp://$RACK/pxelinux.cfg/default`
`http://$RACK:5248/pxelinux.cfg/default`
### **Machine PXELinux i386, AMD64**
NOTE: $MAC is delaminated with a '-' e.g 52-54-00-20-b1-01
`tftp://$RACK/pxelinux.cfg/01-$MAC`
`http://$RACK:5248/pxelinux.cfg/01-$MAC`
## **Static GRUB UEFI AMD64, ARM64**
`tftp://$RACK/grub/grub.cfg-default-amd64`
`http://$RACK:5248/grub/grub.cfg-default-amd64`
## **Machine GRUB UEFI AMD64, ARM64**
NOTE: $MAC is delaminated with a ':' e.g 52:54:00:dd:d1:50
`tftp://$RACK/grub/grub.cfg-$MAC`
`http://$RACK:5248/grub/grub.cfg-$MAC`
## **Metadata server**
================
MAAS implements a subset of the EC2 metadata service 10 to provide machines with data such as hostname, SSH keys, and user data to be run. Only a subset of data can be accessed anonymously, most data requires OAUTH1 credentials.
#### Accessing the metadata server
Note: As of MAAS 2.5 each rack controller runs an nginx HTTP proxy service which allows machines to only have to interact with the rack controller.
#### Metadata directly from the region
`http://$REGION:5240/MAAS/metadata/latest/`
#### Metadata through the nginx proxy
`http://$RACK:5248/MAAS/metadata/latest`
## **Preseeds**
The preseed contains the initial configuration for cloud-init to configure the system. Two URLs are available, one during enlistment and another used by all other environments.
`http://$REGION:5240/MAAS/metadata/latest/enlist-preseed/?op=get_enlist_preseed
`http://$REGION:5240/MAAS/metadata/latest/by-id/$SYSTEM_ID/?op=get_preseed
##e **Userdata**
The userdata contains scripts and other configuration data which is run by cloud-init. MAAS creates userdata by starting with a template and adding additional required data. These templates can be found in
`/etc/maas/preseeds/userdata`
The data is then base64 encoded and returned to the client.
## **Enlistment userdata**
Enlistment userdata can be access anonymously
`http://$REGION:5240/MAAS/metadata/enlist/latest/user-data`
## **Userdata for Curtin(deploying)**
`http://$REGION:5248/MAAS/curtin/latest/user-data`
### **All other ephemeral environments**
Note: This method requires OAUTH1 credentials
`http://$REGION:5240/MAAS/metadata/latest/user-data`
## **Internal SimpleStreams mirror**
===============================
The MAAS region provides all rack controllers with images by creating a SimpleStream with the images an administrator has selected to be downloaded. Like images.maas.io 2 an index.json is provided however only one product stream is created.
`http://$REGION:5240/MAAS/images-stream/streams/v1/index.json`
`http://$REGION:5240/MAAS/images-stream/streams/v1/maas:v2:download.json`
Images:
=========
Images can be downloaded by concatenating the images-streams endpoint with the path in the product stream. For example
http://$REGION:5240/MAAS/images-stream/ubuntu/amd64/hwe-18.04/bionic/20200831/squashfs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment