Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation #158

Open
KnKay opened this issue Feb 13, 2023 · 7 comments
Open

Documentation #158

KnKay opened this issue Feb 13, 2023 · 7 comments
Labels

Comments

@KnKay
Copy link
Contributor

KnKay commented Feb 13, 2023

Hi all,

saw there is some new efi stuff in the config.

https://github.com/hashicorp/packer-plugin-proxmox/blob/main/builder/proxmox/common/config.go#L107
due to the documentation
https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs/builders/iso.mdx?plain=1#L367

The variables are named differently. I guess this should be updated?
I have no proxmox to test at the moment. :(

@KnKay KnKay added the question label Feb 13, 2023
@sebastian-de
Copy link
Contributor

Hey @KnKay,
the documentation definitely needs some love and if I find the time I'd like to rewrite parts of it.

The Proxmox builder uses nested structs quite often (which also makes it difficult to generate the documentation automatically from the source files), so efi_config is defined here.

All in all, the documentation for EFI parameters looks correct to me.

@zeddD1abl0
Copy link

@sebastian-de - I'm going to undertake some documentation work on this. HCL is missing from a number of the key areas that made it hell for me to figure out. I'll update this issue with progress. I'm trying not to just rewrite the whole thing as I see fit, because it may not line up with what the expected standard is.

On top of this, is there anything specific I should pay attention to? I'm going to be re-organizing a heap of it and changing some wordings here and there, and adding HCL examples, but is there any part of the flags that's currently missing?

@zeddD1abl0
Copy link

So, I spent a few hours fixing up the documentation to match my expectations and reordering things to match "Within each category, the available configuration keys are alphabetized". If someone would like to give the documents a quick review and let me know if I missed anything, that'd be great:

Clone

ISO

I do still need to go through and sort out if I missed any properties, etc. but, for the moment, the documents should be a bit neater and have the various HCL vs JSON values.

@goffinf
Copy link

goffinf commented Apr 10, 2023

The doc for clone still appears to include elements from an ISO build ?

@zeddD1abl0
Copy link

Do you mind me asking which bits in particular?

Judging based off the config.hcl2spec.go there are only 8 properties that ISO has that is unique, those being related directly to the ISO to use (iso_checksum, etc). Clone replaces these with 5 of it's own unique entries like "clone_vm_id" and "clone_vm". Otherwise, clone and ISO appear to share a number of attributes.

Specifically, ISO makes use of:

  • iso_checksum
  • iso_url
  • iso_urls
  • iso_target_path
  • iso_target_extension
  • iso_file
  • iso_storage_pool
  • iso_download_pve
  • unmount_iso

Whereas Clone makes use of:

  • clone_vm
  • clone_vm_id
  • full_clone
  • nameserver
  • searchdomain
  • ipconfig

If you're referring to the contents of blocks like "addinitional_iso_files", I believe these have a consistent interface across the whole plugin, and so they shouldn't be difficult on a "clone vs ISO" basis.

@goffinf
Copy link

goffinf commented Apr 10, 2023

No I didn't get as far as examining all the individual properties, it was just on first glance I noticed that in the CLONE doc, the example starts with:

source "proxmox_iso" "documentation" {
...

and then ...

{
  "builders": [
    {
      "type": "proxmox-iso",
      ...

Now I haven't done a Packer build with Proxmox for a while and it may only be convention rather than a strict syntactic requirement, but I have always used a a source of proxmox-clone if I'm doing a clone and proxmox-iso if I'm building from an ISO image. Otherwise it seems somewhat confusing if you mix the 2 regardless of whether it actually works or not, it just seems like a good practice IMHO.

Something like this:

source "proxmox-clone" "k8s-tools-template" {
  boot                     = "order=scsi0"
  boot_wait                = "${var.boot_wait}"
  clone_vm                 = "${local.proxmox_template_name}"
  ...
}
build {
  sources = ["source.proxmox-clone.k8s-tools-template"]

  provisioner "file" {
    ...
variable "boot_wait" {
  type    = string
  default = "5s"
}
variable "clone_template_names" {
    description = "Proxmox template name"
...

locals {
  proxmox_template_name = lookup(var.clone_template_names, var.clone_template_name, "ubuntu-20.04-base-os-cloudinit-template")
  ...
}

and for ISO builds:

source "proxmox-iso" "ubuntu-base-os-cloud-init-template" {
  boot                    = "order=scsi0;ide2"
  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               = "${var.boot_wait}"
  cloud_init              = true
  ...
}
build {

  sources = ["source.proxmox-iso.ubuntu-base-os-cloud-init-template"]
  ...
}

But maybe YMMV

HtHs

Fraser

@zeddD1abl0
Copy link

Ah, good pickup. That was a case of my lazy ass copy-pasting from the ISO documentation I did first. Thank you for that. I've now fixed it so that it references proxmox-clone.

Yes, it has to be the correct source for it to work properly, that's how it determines the plugin to load. My bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants