variable "iso_checksum" {
type = string
default = "5035be37a7e9abbdc09f0d257f3e33416c1a0fb322ba860d42d74aa75c3468d4"
}
variable "iso_url" {
type = string
default = "ubuntu-20.04.5-live-server-amd64.iso"
}
# boot_command issues solved by:
# https://github.com/hashicorp/packer/issues/9115
source "parallels-iso" "ubuntu-pa" {
boot_command = [
"<tab><tab><tab><tab><tab><c><wait><bs><bs>",
"linux /casper/vmlinuz --- autoinstall ds=\"nocloud-net;seedfrom=http://{{.HTTPIP}}:{{.HTTPPort}}/\"<enter><wait>",
"initrd /casper/initrd<enter><wait>",
"boot<enter>"
]
...
the boot waits for select language:

user-data is:
#cloud-config
autoinstall:
version: 1
locale: en_US
keyboard:
layout: en
variant: us
network:
network:
version: 2
ethernets:
ens33:
dhcp4: true
apt:
geoip: true
storage:
layout:
name: lvm
identity:
hostname: ubuntu
username: ubuntu
# pass is ubuntu
password: $6$rounds=4096$8dkK1P/oE$2DGKKt0wLlTVJ7USY.0jN9du8FetmEr51yjPyeiR.zKE3DGFcitNL/nF1l62BLJNR87lQZixObuXYny.Mf17K1
ssh:
install-server: yes
allow-pw: true
packages:
- basez
- dialog
- vim
- tmux
- git
- uuid
- software-properties-common
- apt-transport-https
- python3-pip
- python3-venv
- python3-dev
user-data:
disable_root: false
package_update: true
package_upgrade: true
write_files:
- path: /etc/sudoers.d/ubuntu
owner: 'root:root'
permissions: '0644'
defer: true
content:
ubuntu ALL=(ALL) NOPASSWD:ALL
- path: /root/welcome.txt
owner: 'root:root'
permissions: '0644'
defer: true
content:
Welcome to Ubuntu root.
- encoding: b64
path: /etc/modprobe.d/cust-blacklist.conf
owner: 'root:root'
permissions: '0644'
defer: true
content: YmxhY2tsaXN0IGpveWRldgpibGFja2xpc3Qgc25kX2hkYV9pbnRlbApibGFja2xpc3Qgc25kX2hkYV9jb2RlYwpibGFja2xpc3Qgc25kX2hkYV9jb2RlY19nZW5lcmljCmJsYWNrbGlzdCBzbmRfaGRhX2NvcmUKYmxhY2tsaXN0IHNuZF9wY20KYmxhY2tsaXN0IHNuZF9od2RlcApibGFja2xpc3Qgc25kX3RpbWVyCmJsYWNrbGlzdCBzbmQKYmxhY2tsaXN0IHNvdW5kY29yZQ==
- encoding: b64
path: /etc/ansible/facts.d/vmhost.fact
owner: 'root:root'
permissions: '0755'
defer: true
content: IyEvdXNyL2Jpbi9lbnYgc2gKZWNobyAie1widm0tY2xvdWQtaW5pdFwiIDogXCJ0cnVlXCJ9Ig==
late-commands:
- curtin in-target --target=/target -- add-apt-repository --yes --update ppa:ansible/ansible
- curtin in-target --target=/target -- apt install ansible -y -q
- mkdir /target/etc/ansible/facts.d
- 'sed -i "s/dhcp4: true/&\n dhcp-identifier: mac/" /target/etc/netplan/00-installer-config.yaml'
- uptime
- echo finished
type = string
default = "5035be37a7e9abbdc09f0d257f3e33416c1a0fb322ba860d42d74aa75c3468d4"
}
variable "iso_url" {
type = string
default = "ubuntu-20.04.5-live-server-amd64.iso"
}
# boot_command issues solved by:
# https://github.com/hashicorp/packer/issues/9115
source "parallels-iso" "ubuntu-pa" {
boot_command = [
"<tab><tab><tab><tab><tab><c><wait><bs><bs>",
"linux /casper/vmlinuz --- autoinstall ds=\"nocloud-net;seedfrom=http://{{.HTTPIP}}:{{.HTTPPort}}/\"<enter><wait>",
"initrd /casper/initrd<enter><wait>",
"boot<enter>"
]
...
the boot waits for select language:

user-data is:
#cloud-config
autoinstall:
version: 1
locale: en_US
keyboard:
layout: en
variant: us
network:
network:
version: 2
ethernets:
ens33:
dhcp4: true
apt:
geoip: true
storage:
layout:
name: lvm
identity:
hostname: ubuntu
username: ubuntu
# pass is ubuntu
password: $6$rounds=4096$8dkK1P/oE$2DGKKt0wLlTVJ7USY.0jN9du8FetmEr51yjPyeiR.zKE3DGFcitNL/nF1l62BLJNR87lQZixObuXYny.Mf17K1
ssh:
install-server: yes
allow-pw: true
packages:
- basez
- dialog
- vim
- tmux
- git
- uuid
- software-properties-common
- apt-transport-https
- python3-pip
- python3-venv
- python3-dev
user-data:
disable_root: false
package_update: true
package_upgrade: true
write_files:
- path: /etc/sudoers.d/ubuntu
owner: 'root:root'
permissions: '0644'
defer: true
content:
ubuntu ALL=(ALL) NOPASSWD:ALL
- path: /root/welcome.txt
owner: 'root:root'
permissions: '0644'
defer: true
content:
Welcome to Ubuntu root.
- encoding: b64
path: /etc/modprobe.d/cust-blacklist.conf
owner: 'root:root'
permissions: '0644'
defer: true
content: YmxhY2tsaXN0IGpveWRldgpibGFja2xpc3Qgc25kX2hkYV9pbnRlbApibGFja2xpc3Qgc25kX2hkYV9jb2RlYwpibGFja2xpc3Qgc25kX2hkYV9jb2RlY19nZW5lcmljCmJsYWNrbGlzdCBzbmRfaGRhX2NvcmUKYmxhY2tsaXN0IHNuZF9wY20KYmxhY2tsaXN0IHNuZF9od2RlcApibGFja2xpc3Qgc25kX3RpbWVyCmJsYWNrbGlzdCBzbmQKYmxhY2tsaXN0IHNvdW5kY29yZQ==
- encoding: b64
path: /etc/ansible/facts.d/vmhost.fact
owner: 'root:root'
permissions: '0755'
defer: true
content: IyEvdXNyL2Jpbi9lbnYgc2gKZWNobyAie1widm0tY2xvdWQtaW5pdFwiIDogXCJ0cnVlXCJ9Ig==
late-commands:
- curtin in-target --target=/target -- add-apt-repository --yes --update ppa:ansible/ansible
- curtin in-target --target=/target -- apt install ansible -y -q
- mkdir /target/etc/ansible/facts.d
- 'sed -i "s/dhcp4: true/&\n dhcp-identifier: mac/" /target/etc/netplan/00-installer-config.yaml'
- uptime
- echo finished