Commit e40bdb1d authored by Thomas Gambier's avatar Thomas Gambier

packer: add Ubuntu 22.04 image

The installation is now using cloud-init config instead of preseed files
(see https://ubuntu.com/server/docs/install/autoinstall).

For now, it's not possible to have different file names than "user-data"
and "meta-data" and the hostname is hardcoded in "user-data" so it won't
work for Ubuntu 24.04 (see
https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html).
parent 2cf33da9
Pipeline #24473 failed with stage
in 0 seconds
#cloud-config
autoinstall:
version: 1
locale: en_US
keyboard:
layout: fr
early-commands:
- systemctl stop ssh
identity:
hostname: ubuntu-22.04-server-packer
password: $6$Vp3f6376c$drEet9S.22yaIgY6.tiYVzRgGmWfsMjIWcwOWoGB.uuWD8SbpSz0TR8BOeWvjt2/IAcEXMa171WcmGXMuXNzI/
username: slapos
storage:
layout:
name: direct
network:
network:
version: 2
ethernets:
ens3: {dhcp4: true}
ssh:
install-server: true
allow-pw: true
packages:
- openssh-server
- sudo
- curl
- vim
user-data:
disable_root: false
timezone: UTC
{
"builders": [
{
"accelerator": "kvm",
"boot_command": [
"c<wait>",
"linux /casper/vmlinuz --- autoinstall ds=\"nocloud-net;seedfrom=http://{{.HTTPIP}}:{{.HTTPPort}}/\"",
"<enter><wait>",
"initrd /casper/initrd",
"<enter><wait>",
"boot",
"<enter>"
],
"boot_wait": "2s",
"cpus": 2,
"disk_size": "{{ user `disk_size`}}000",
"format": "qcow2",
"headless": true,
"http_directory": "http",
"iso_checksum": "sha256:10f19c5b2b8d6db711582e0e27f5116296c34fe4b313ba45f9b201a5007056cb",
"iso_url": "https://releases.ubuntu.com/22.04/ubuntu-22.04.1-live-server-amd64.iso",
"memory": 2048,
"name": "ubuntu-22.04-server-{{ user `disk_size`}}G-{{ user `name`}}",
"shutdown_command": "echo '{{user `password`}}'|sudo -S poweroff",
"ssh_password": "{{user `password`}}",
"ssh_timeout": "1800s",
"ssh_username": "{{user `user`}}",
"type": "qemu"
}
],
"provisioners": [
{
"execute_command": "echo '{{user `password`}}' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
"scripts": [
"scripts/update-ubuntu.sh",
"scripts/grub-ubuntu.sh",
"{{ user `custom_script` }}"
],
"type": "shell"
}
],
"variables": {
"custom_script": "scripts/empty.sh",
"disk_size": "20",
"domain": "",
"name": "image",
"password": "slapos",
"user": "slapos"
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment