Образ Ubuntu 20.04 with Packer (VirtualBox)

Всем Привет.
Automating Ubuntu 20.04 images with Packer — хотел повторить, но Запускается с опцией ‘‘try ubuntu without installation’’)
Не знаю уже что искать…
json file:

{
  "variables": {

    "version": "",

    "disk_size": "36864",

    "memory": "4096",

    "ssh_password": "1",

    "ssh_username": "ubuntupack",

    "vcpus": "2"

  },

  "provisioners": [

    {

      "type": "shell",

      "execute_command": "echo '1' | {{.Vars}} sudo -S -E bash '{{.Path}}'",

      "script": "install_script.sh"

    }

  ],

  "builders": [

    {

      "type": "virtualbox-iso",

      "boot_command": [

        "<esc><wait><esc><wait><f6><wait><esc><wait>",

        "<bs><bs><bs><bs><bs>",

        "autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ ",

        "--- <enter>"

      ],

      "boot_wait": "5s",

      "disk_size": "{{ user `disk_size` }}",

      "guest_os_type": "Ubuntu_64",

      "headless": true,

      "http_directory": "http",

      "iso_urls": [

        "iso-cd/ubuntu-20.04.1-desktop-amd64.iso",

        "https://ubuntu-releases.ip-connect.vn.ua/20.04.1/ubuntu-20.04.1-desktop-amd64.iso"

      ],

      "iso_checksum": "sha256:b45165ed3cd437b9ffad02a2aad22a4ddc69162470e2622982889ce5826f6e3d",

      "ssh_username": "{{ user `ssh_username` }}",

      "ssh_password": "{{ user `ssh_password` }}",

      "ssh_pty": true,

      "ssh_port": 22,

      "ssh_handshake_attempts": "20",

      "ssh_wait_timeout": "10000s",

      "shutdown_command": "echo '1'|sudo -S shutdown -P now",

      "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",

      "virtualbox_version_file": ".vbox_version",

      "vm_name": "ubuntu-2004",

      "vboxmanage": [

        [

          "modifyvm",

          "{{.Name}}",

          "--memory",

          "{{ user `memory` }}"

        ],

        [

          "modifyvm",

          "{{.Name}}",

          "--cpus",

          "{{ user `vcpus` }}"

        ]

      ]

    }

  ]

}

user-data file:


#cloud-config

autoinstall:

  version: 1

  early-commands:

    - systemctl stop ssh # otherwise packer tries to connect and exceed max attempts

  locale: en_US

  keyboard:

    layout: en

    variant: us

  identity:

    hostname: ubuntu-server

    password: '1'

    username: ubuntupack

  network:

    network:

      version: 2

      ethernets:

        ens33: 

          dhcp4: true

          dhcp-identifier: mac

  apt:

    geoip: true

    preserve_sources_list: false

    primary:

    - arches: [amd64, i386]

      uri: http://gb.archive.ubuntu.com/ubuntu

    - arches: [default]

      uri: http://ports.ubuntu.com/ubuntu-ports     

  ssh:

    install-server: true

  late-commands:

    - sed -i 's/^#*\(send dhcp-client-identifier\).*$/\1 = hardware;/' /target/etc/dhcp/dhclient.conf

    - 'sed -i "s/dhcp4: true/&\n      dhcp-identifier: mac/" /target/etc/netplan/00-installer-config.yaml'

Привет, можешь по человеки оформить пост, непонятно что и куда относится и в чем ошибка?

1 Like