diff --git a/.gitignore b/.gitignore index 2c7778d..1118530 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ +**/dist/* **/packer_cache/* -**/packer_output/* **/.terraform/* *.tfstate *.tfstate.* diff --git a/http/seed/meta-data b/qemu/http/seed/meta-data similarity index 100% rename from http/seed/meta-data rename to qemu/http/seed/meta-data diff --git a/http/seed/user-data b/qemu/http/seed/user-data similarity index 100% rename from http/seed/user-data rename to qemu/http/seed/user-data diff --git a/start-qemu.sh b/qemu/start-vm.sh similarity index 100% rename from start-qemu.sh rename to qemu/start-vm.sh diff --git a/wireguard.pkr.hcl b/wireguard.build.pkr.hcl similarity index 68% rename from wireguard.pkr.hcl rename to wireguard.build.pkr.hcl index 1bbd967..0b1b1db 100644 --- a/wireguard.pkr.hcl +++ b/wireguard.build.pkr.hcl @@ -1,52 +1,3 @@ -source "hcloud" "main" { - image = "ubuntu-18.04" - server_type = "cx11" - location = "fsn1" - - server_name = "wireguard-{{timestamp}}" - snapshot_name = "wireguard-{{timestamp}}" - snapshot_labels { - service = "wireguard" - } - - ssh_port = "22" - ssh_username = "root" - ssh_timeout = "10m" -} - -source "qemu" "main" { - iso_url = "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img" - iso_checksum_url = "https://cloud-images.ubuntu.com/bionic/current/SHA256SUMS" - iso_checksum_type = "sha256" - disk_image = true - - vm_name = "wireguard.qcow2" - http_directory = "./http/" - output_directory = "./packer_output/" - - accelerator = "kvm" - cpus = 1 - memory = 512 - headless = true - qemuargs { - qemuargs = ["-smbios", "type=1,serial=ds=nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/seed/"] - } - - net_device = "virtio-net" - - format = "qcow2" - disk_size = "4G" - disk_interface = "virtio" - disk_compression = false - - ssh_port = "22" - ssh_username = "root" - ssh_password = "toor" - ssh_timeout = "10m" - - shutdown_command = "shutdown -P now" -} - build { sources = [ "source.hcloud.main" diff --git a/wireguard.sources.pkr.hcl b/wireguard.sources.pkr.hcl new file mode 100644 index 0000000..91ff8cc --- /dev/null +++ b/wireguard.sources.pkr.hcl @@ -0,0 +1,48 @@ +source "hcloud" "main" { + image = "ubuntu-18.04" + server_type = "cx11" + location = "fsn1" + + server_name = "wireguard-{{timestamp}}" + snapshot_name = "wireguard-{{timestamp}}" + snapshot_labels { + service = "wireguard" + } + + ssh_port = "22" + ssh_username = "root" + ssh_timeout = "10m" +} + +source "qemu" "main" { + iso_url = "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img" + iso_checksum_url = "https://cloud-images.ubuntu.com/bionic/current/SHA256SUMS" + iso_checksum_type = "sha256" + disk_image = true + + vm_name = "wireguard.qcow2" + http_directory = "./qemu/http/" + output_directory = "./qemu/dist/" + + accelerator = "kvm" + cpus = 1 + memory = 512 + headless = true + qemuargs { + qemuargs = ["-smbios", "type=1,serial=ds=nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/seed/"] + } + + net_device = "virtio-net" + + format = "qcow2" + disk_size = "4G" + disk_interface = "virtio" + disk_compression = false + + ssh_port = "22" + ssh_username = "root" + ssh_password = "toor" + ssh_timeout = "10m" + + shutdown_command = "shutdown -P now" +}