Posted
Filed under Computer
* In Ubuntu 20.04
Install packer
~$ wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
~$ echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
~$ sudo apt update && sudo apt install packer
~$ packer --version
1.8.3
Install RHEL8 template dependencies
~$ sudo apt install qemu-utils
~$ sudo apt install qemu-system
Get packer templates
Change to centos8-stream template
~$ cd packer-maas/centos8-stream
if you want change KS filethen  modify http/centos8-stream.ks file.
packer-maas/centos8-stream$ ls http/
centos8-stream.ks
Build the CentOS 8 stream image from ISO file.
packer-maas/centos8-stream$ make ISO=/global/iso/CentOS-Stream-8-x86_64-20220728-dvd1.iso
created centos8-stream.tar.gz file.
packer-maas/centos8-stream$ ls
centos8-stream.json centos8-stream.tar.gz http Makefile output-qemu README.md
Copy the image file to MAAS server.
packer-maas/ centos8-stream$ scp centos8-stream.tar.gz user@maas-server:
* In maas-server
(https://ubuntu.com/blog/cli-only-maas-operation)
Need MAAS API-KEY-FILE
~$ cat api-key-file
xlfU9XtKzmaJMAa3w7:Gq6fZxzZ6g9HsQAeKW:NGJ5qAtJrF929TU8cKCdUUqtqzwGjBbw3
Login to admin in MAAS
~$  maas login admin http://maas-server:5240/MAAS
API key (leave empty for anonymous access):
You are now logged in to the MAAS server at
http://maas-server:5240/MAAS/api/2.0/ with the profile name 'admin'.
For help with the available commands, try:
  maas admin --help
check boot resource
~$ maas admin boot-resources read
Import the image to MAAS in maas-server
*Not support Rocky OS, CentOS 8.3
~$ maas admin boot-resources create name=centos/8-stream title='CentOS8-stream' architecture='amd64/generic' filetype='tgz' content@= centos8-stream.tar.gz
Verify custom image
~$ maas admin boot-resources read
....
{
"id": 13,
"type": "Uploaded",
"name": "centos/8-stream",
"architecture": "amd64/generic",
"resource_uri": "/MAAS/api/2.0/boot-resources/13/",
"subarches": "generic",
"title": "CentOS8-stream"
}
]
Deploy the CentOS Image
goto "Setting" and select "Deploy" under "Configuration".
Select Deployment OS to "CentOS" and release to "CentOS8-stream"

User image

and deploy a machine then the server will start with Ubuntu image. but at the last procedure, the deploy OS with my selected OS (CentOS8-stream).
Login to compute node:
maas-server$ ssh centos@192.168.150.50
[centos@cent-test-host ~]$ cat /etc/redhat-release
CentOS Stream release 8
Default user without password:
CentOS -> centos
Ubuntu -> ubuntu
Setting Password-less SSH-key in MAAS
goto "admin" -> SSH keys -> "import SSH key"
then the default user will defined with this SSH key. So you can login to server with default username with imported SSH key.

Good works OS:
centos 7
centos 8-stream
2022/08/04 07:27 2022/08/04 07:27
[로그인][오픈아이디란?]