diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf391e5..1930209 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,6 +6,7 @@ name: Build the boxes types: - published - prereleased + pull_request: jobs: collect: @@ -24,7 +25,7 @@ jobs: build: name: Build box - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - collect strategy: diff --git a/distros/fedora-34-x86_64.pkrvars.hcl b/distros/fedora-34-x86_64.pkrvars.hcl index c6b2038..1e46212 100644 --- a/distros/fedora-34-x86_64.pkrvars.hcl +++ b/distros/fedora-34-x86_64.pkrvars.hcl @@ -6,5 +6,5 @@ iso = { } boot_command = [ "", - "net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/fedora/34-x86_64.ks console=ttyS0" + "net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/fedora/34-x86_64.ks console=ttyS0 " ] diff --git a/distros/fedora-35-x86_64.pkrvars.hcl b/distros/fedora-35-x86_64.pkrvars.hcl index 654872e..b08e7c7 100644 --- a/distros/fedora-35-x86_64.pkrvars.hcl +++ b/distros/fedora-35-x86_64.pkrvars.hcl @@ -6,5 +6,5 @@ iso = { } boot_command = [ "", - "edd=off net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/fedora/35-x86_64.ks console=ttyS0" + "net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/fedora/35-x86_64.ks console=ttyS0 " ] diff --git a/distros/fedora-36-x86_64.pkrvars.hcl b/distros/fedora-36-x86_64.pkrvars.hcl index 3ee255d..0408337 100644 --- a/distros/fedora-36-x86_64.pkrvars.hcl +++ b/distros/fedora-36-x86_64.pkrvars.hcl @@ -6,5 +6,5 @@ iso = { } boot_command = [ "", - "edd=off net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/fedora/36-x86_64.ks console=ttyS0" + "net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/fedora/36-x86_64.ks console=ttyS0 " ] diff --git a/distros/fedora-rawhide-x86_64.pkrvars.hcl.sh b/distros/fedora-rawhide-x86_64.pkrvars.hcl.sh index e5be336..3244172 100755 --- a/distros/fedora-rawhide-x86_64.pkrvars.hcl.sh +++ b/distros/fedora-rawhide-x86_64.pkrvars.hcl.sh @@ -35,7 +35,7 @@ iso = { } boot_command = [ "", - "edd=off net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/fedora/rawhide-x86_64.ks console=ttyS0" + "net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/fedora/rawhide-x86_64.ks console=ttyS0 " ] EOF diff --git a/distros/ubuntu-18.04-x86_64.pkrvars.hcl b/distros/ubuntu-18.04-x86_64.pkrvars.hcl index 4b53779..07c26c9 100644 --- a/distros/ubuntu-18.04-x86_64.pkrvars.hcl +++ b/distros/ubuntu-18.04-x86_64.pkrvars.hcl @@ -13,6 +13,6 @@ boot_command = [ "DEBIAN_FRONTEND=noninteractive ", "preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/ubuntu/18.04/preseed.cfg ", "fsck.mode=skip ", - "console=ttyS0 ", + "console=ttyS0", "" ] diff --git a/http/ubuntu/22.04/user-data b/http/ubuntu/22.04/user-data index 04baedc..47dd1dc 100644 --- a/http/ubuntu/22.04/user-data +++ b/http/ubuntu/22.04/user-data @@ -25,7 +25,7 @@ autoinstall: - id: boot-partition type: partition device: drive - size: 200M + size: 1G name: boot - id: swap-partition type: partition diff --git a/sources/build.pkr.hcl b/sources/build.pkr.hcl index dfa3994..1f429e7 100644 --- a/sources/build.pkr.hcl +++ b/sources/build.pkr.hcl @@ -1,9 +1,18 @@ build { - sources = ["source.qemu.x86_64"] + sources = [ + "source.qemu.x86_64", + ] provisioner "ansible" { playbook_file = "ansible/playbook.yml" galaxy_file = "ansible/requirements.yml" + user = local.ssh.username + use_sftp = true + ansible_ssh_extra_args = [ + "-o HostKeyAlgorithms=+ssh-rsa ", + "-o PubkeyAcceptedKeyTypes=+ssh-rsa ", + "-o IdentitiesOnly=yes" + ] } provisioner "shell" { diff --git a/sources/inputs.pkr.hcl b/sources/inputs.pkr.hcl index a9bd52c..addaa76 100644 --- a/sources/inputs.pkr.hcl +++ b/sources/inputs.pkr.hcl @@ -24,34 +24,16 @@ variable "boot_wait" { description = "Length of time to wait before entering boot commands" } -variable "ssh" { - type = map(string) - default = { - username = "vagrant" - password = "vagrant" - } -} - variable "boot_command" { type = list(string) default = [] } -variable "ssh_handshake_attempts" { - type = number - default = 1000 -} - variable "shutdown_command" { type = string default = "sudo systemctl poweroff" } -variable "disk_size" { - type = string - default = "20G" -} - variable "headless" { type = bool default = true @@ -62,11 +44,6 @@ variable "vagrant_cloud_token" { default = env("VAGRANT_CLOUD_TOKEN") } -variable "qemu_accelerator" { - type = string - default = "kvm" -} - locals { name = "${var.distro}-${var.version}-${var.arch}" build = formatdate("YYYYMMDDhh", timestamp()) @@ -76,4 +53,14 @@ locals { version = var.version build = local.build }) + + cpus = 2 + memory = 2048 + disk_size = 10 + ssh = { + username = "vagrant" + password = "vagrant" + handshake_attempts = 1000 + timeout = "5h50m" + } } diff --git a/sources/qemu.pkr.hcl b/sources/qemu.pkr.hcl index d0daa67..d14a32c 100644 --- a/sources/qemu.pkr.hcl +++ b/sources/qemu.pkr.hcl @@ -1,20 +1,30 @@ +variable "qemu_accelerator" { + type = string + default = "kvm" +} + source "qemu" "x86_64" { iso_url = var.iso.url iso_checksum = var.iso.checksum - output_directory = "output_${local.name}" - vm_name = "packer-${local.name}" - disk_size = var.disk_size - boot_wait = var.boot_wait - ssh_timeout = "358m" - ssh_username = var.ssh.username - ssh_password = var.ssh.password - headless = var.headless + output_directory = "output_qemu_${local.name}" + boot_command = var.boot_command - http_directory = "http" - ssh_handshake_attempts = var.ssh_handshake_attempts - accelerator = var.qemu_accelerator - cpus = 2 - memory = 2048 - qemuargs = [["-serial", "stdio"]] shutdown_command = var.shutdown_command + boot_wait = var.boot_wait + ssh_timeout = local.ssh.timeout + ssh_username = local.ssh.username + ssh_password = local.ssh.password + ssh_handshake_attempts = local.ssh.handshake_attempts + + vm_name = "packer-${local.name}" + disk_size = "${local.disk_size}G" + cpus = local.cpus + memory = local.memory + headless = var.headless + disk_cache = "writeback" + format = "qcow2" + + qemuargs = [["-serial", "stdio"]] + http_directory = "http" + accelerator = var.qemu_accelerator } diff --git a/sources/virtualbox-iso.pkr.hcl b/sources/virtualbox-iso.pkr.hcl new file mode 100644 index 0000000..a52209a --- /dev/null +++ b/sources/virtualbox-iso.pkr.hcl @@ -0,0 +1,23 @@ +source "virtualbox-iso" "x86_64" { + iso_url = var.iso.url + iso_checksum = var.iso.checksum + output_directory = "output_virtualbox_${local.name}" + + boot_command = var.boot_command + shutdown_command = var.shutdown_command + boot_wait = var.boot_wait + + ssh_timeout = local.ssh.timeout + ssh_username = local.ssh.username + ssh_password = local.ssh.password + ssh_handshake_attempts = local.ssh.handshake_attempts + + vm_name = "packer-${local.name}" + disk_size = "${local.disk_size}000" + cpus = local.cpus + memory = local.memory + headless = var.headless + guest_os_type = "${var.distro}_64" + + http_directory = "http" +}