|
|
|
|
|
by weitzj
425 days ago
|
|
Love it. Also using UTM with Amazon Linux 2023 x64 on an M1 works, so you can create a local HashiCorp Packer Pipeline using the Packer UTM plugin (similar to the QEMU Packer plugin) source "utm-cloud" "this" {
iso_url = "${path.root}/dev_images/al2023-kvm-2023.6.20250303.0-kernel-6.1-x86_64.xfs.gpt.qcow2"
iso_checksum = "sha256:0dc2797fe19847f6c75878dd344ab478ac0657077d9a15f2907bb2df41d8c3de"
vm_arch = "x86_64"
cpus = 2
memory = 4096
display_nopause = true
boot_nopause = true
export_nopause = true
skip_nat_mapping = true
communicator = "ssh"
ssh_clear_authorized_keys = true
ssh_private_key_file = data.sshkey.this.private_key_path
ssh_host = "192.168.64.100"
ssh_port = 22
ssh_username = "ec2-user"
shutdown_command = "echo 'packer' | sudo -S /sbin/halt -h -p"
use_cd = true
cd_label = "cidata"
cd_content = {
"meta-data" = <<EOF
local-hostname: vm-hostname
EOF
"user-data" = <<EOF
#cloud-config
ssh_sftp:
enabled: true
password: ec2-user
ssh_pwauth: True
chpasswd:
expire: False
users:
- default
- name: ec2-user
lock_passwd: false
plain_text_passwd: ec2-user
ssh_authorized_keys:
- ${data.sshkey.this.public_key}
EOF
"network-config" = <<EOF
#cloud-config
version: 2
ethernets:
enp0s1:
# dhcp4: yes
addresses:
- 192.168.64.100/24
gateway4: 192.168.64.1
nameservers:
addresses:
- 10.0.2.2
enp0s2:
dhcp4: no
state: down
EOF
}
} |
|