summaryrefslogtreecommitdiff
path: root/packer/ubuntu-24.04-server.json
blob: c40098f9237a271ceecaa8153c52111ec0e5b33d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{
  "variables": {
    "iso_name": "ubuntu-24.04-live-server-amd64.iso",
    "iso_url": "https://old-releases.ubuntu.com/releases/24.04/ubuntu-24.04-live-server-amd64.iso",
    "iso_path": "{{pwd}}/iso/{{user `iso_name`}}",
    "iso_sha256": "sha256:8762f7e74e4d64d72fceb5f70682e6b069932deedb4949c6975d0f0fe0a91be3",
    "timestamp": "{{isotime `2006-01-02`}}",
    "headless": "false",
    "boot_wait": "5s",

    "local_iso_url": "", 
    "local_iso": "{{user `local_iso_url`}}/{{user `iso_name`}}",
    "output": "",
        
    "name": "ubuntu-24.04-server",
    "cpu": "2",
    "cores": "2",
    "ram": "2048",
    "disk_size": "102400",
    "communicator_username": "root",
    "communicator_password": "root",
    "lowpriv_user": "ubuntu"
  },

  "builders": [
    {
      "type": "qemu",
      "format": "qcow2",
      "accelerator": "kvm",
      "net_device": "virtio-net",
      "disk_interface": "virtio",
      "headless": "{{user `headless`}}",
      "name": "qemu",
      "vm_name": "qemu-{{user `name`}}_{{user `timestamp`}}",
      "disk_size": "{{user `disk_size`}}",
      "disk_cache": "none",
      "disk_discard": "unmap",
      "disk_compression": true,
      "communicator": "ssh",
      "ssh_username": "{{user `communicator_username`}}",
      "ssh_password": "{{user `communicator_password`}}",
      "ssh_pty": true,
      "ssh_timeout": "60m",
      "ssh_handshake_attempts": "1337",
      "shutdown_command": "shutdown -P now",
      "boot_wait": "{{user `boot_wait`}}",
      "boot_command": [
        "c<wait>",
        "set gfxpayload=keep<enter><wait>",
        "linux /casper/vmlinuz --- quiet splash autoinstall ds='nocloud-net;seedfrom=http://{{.HTTPIP}}:{{.HTTPPort}}/'<enter><wait>",
        "initrd /casper/initrd<enter><wait>",
        "boot<enter><wait>"
      ],
      "iso_urls": [
        "{{user `iso_path`}}",
        "{{user `local_iso`}}",
        "{{user `iso_url`}}"
      ],
      "iso_checksum": "{{user `iso_sha256`}}",
      "iso_target_path": "{{user `iso_path`}}",
      "http_directory": "files/answer_files/linux/ubuntu/24.04-server",
      "output_directory": "qemu_output_{{user `name`}}",
      "qemuargs": [
        ["-m", "{{user `ram`}}M"],
        ["-cpu", "host"],
        ["-smp", "cpus={{user `cpu`}}"]
      ]
    }
  ],

  "provisioners": [
    {
      "type": "shell",
      "script": "files/scripts/linux/setup-qemu-guest-agent.sh"
    },
    {
      "type": "shell",
      "script": "files/scripts/linux/sysprep.sh"
    }
  ],

  "post-processors": [
    {
      "type": "shell-local",
      "only_on": ["linux"],
      "environment_vars": [
        "NAME={{user `name`}}",
        "TIMESTAMP={{user `timestamp`}}",
        "OUTPUT={{user `output`}}"
      ],
      "script": "files/scripts/create-checksums.sh"
    }
  ]
}