{"id":15637156,"url":"https://github.com/rgl/proxmox-ve","last_synced_at":"2025-04-04T22:04:54.272Z","repository":{"id":15534636,"uuid":"78332258","full_name":"rgl/proxmox-ve","owner":"rgl","description":"Proxmox VE Vagrant Base Box","archived":false,"fork":false,"pushed_at":"2024-11-21T19:29:46.000Z","size":96,"stargazers_count":116,"open_issues_count":1,"forks_count":39,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T21:04:08.047Z","etag":null,"topics":["packer","proxmox","proxmox-ve","vagrant"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rgl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-08T09:02:56.000Z","updated_at":"2025-03-23T20:35:28.000Z","dependencies_parsed_at":"2025-02-22T21:11:09.144Z","dependency_job_id":"9778f944-5160-42ea-ab76-90652b5c9dde","html_url":"https://github.com/rgl/proxmox-ve","commit_stats":{"total_commits":108,"total_committers":13,"mean_commits":8.307692307692308,"dds":"0.19444444444444442","last_synced_commit":"5ac1db15c1c9f415c376c011b5ea89e2beb97abe"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fproxmox-ve","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fproxmox-ve/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fproxmox-ve/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fproxmox-ve/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rgl","download_url":"https://codeload.github.com/rgl/proxmox-ve/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256110,"owners_count":20909240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["packer","proxmox","proxmox-ve","vagrant"],"created_at":"2024-10-03T11:10:30.404Z","updated_at":"2025-04-04T22:04:54.256Z","avatar_url":"https://github.com/rgl.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"This builds an up-to-date [Proxmox VE](https://www.proxmox.com/en/proxmox-ve) Vagrant Base Box.\n\nCurrently this targets Proxmox VE 8.\n\n# Usage\n\nCreate the base box as described in the section corresponding to your provider.\n\nIf you want to troubleshoot the packer execution see the `.log` file that is created in the current directory.\n\nAfter the example vagrant environment is started, you can access the [Proxmox Web Interface](https://10.10.10.2:8006/) with the default `root` user and password `vagrant`.\n\nFor a cluster example see [rgl/proxmox-ve-cluster-vagrant](https://github.com/rgl/proxmox-ve-cluster-vagrant).\n\n## libvirt\n\nCreate the base box:\n\n```bash\nmake build-libvirt\n```\n\nAdd the base box as suggested in make output:\n\n```bash\nvagrant box add -f proxmox-ve-amd64 proxmox-ve-amd64-libvirt.box\n```\n\nStart the example vagrant environment with:\n\n```bash\ncd example\nvagrant up --no-destroy-on-error --provider=libvirt\n```\n\n## Proxmox\n\nSet the Proxmox VE details:\n\n```bash\ncat \u003esecrets-proxmox.sh \u003c\u003cEOF\nexport PROXMOX_URL='https://192.168.1.21:8006/api2/json'\nexport PROXMOX_USERNAME='root@pam'\nexport PROXMOX_PASSWORD='vagrant'\nexport PROXMOX_NODE='pve'\nEOF\nsource secrets-proxmox.sh\n```\n\nCreate the template:\n\n```bash\nmake build-proxmox\n```\n\n**NB** There is no way to use the created template with vagrant (the [vagrant-proxmox plugin](https://github.com/telcat/vagrant-proxmox) is no longer compatible with recent vagrant versions). Instead, use packer or terraform.\n\n## Hyper-V\n\nFollow the [rgl/windows-vagrant Hyper-V Usage section](https://github.com/rgl/windows-vagrant#hyper-v-usage) to create the `Vagrant` vSwitch for use by the packer template and the example vagrant environment.\n\nCreate the `proxmox` vSwitch for use in the example vagrant environment second\nnetwork interface:\n\n```bash\nPowerShell -NoLogo -NoProfile -ExecutionPolicy Bypass \u003c\u003c'EOF'\n$switchName = 'proxmox'\n$networkAdapterName = \"vEthernet ($switchName)\"\n$networkAdapterIpAddress = '10.10.10.1'\n$networkAdapterIpPrefixLength = 24\n\n# create the vSwitch.\nNew-VMSwitch -Name $switchName -SwitchType Internal | Out-Null\n\n# assign it an host IP address.\n$networkAdapter = Get-NetAdapter $networkAdapterName\n$networkAdapter | New-NetIPAddress `\n    -IPAddress $networkAdapterIpAddress `\n    -PrefixLength $networkAdapterIpPrefixLength `\n    | Out-Null\n\n# remove all virtual switches from the windows firewall.\nSet-NetFirewallProfile `\n    -DisabledInterfaceAliases (\n            Get-NetAdapter -name \"vEthernet*\" | Where-Object {$_.ifIndex}\n        ).InterfaceAlias\nEOF\n```\n\nSet the Hyper-V details:\n\n```bash\ncat \u003esecrets-hyperv.sh \u003c\u003c'EOF'\n# set this value when you need to set the VM Switch Name.\nexport HYPERV_SWITCH_NAME='Vagrant'\n\n# set this value when you need to set the VM VLAN ID.\nunset HYPERV_VLAN_ID\n#export HYPERV_VLAN_ID=''\n\n# set the credentials that the guest will use\n# to connect to this host smb share.\n# NB you should create a new local user named _vagrant_share\n#    and use that one here instead of your user credentials.\n# NB it would be nice for this user to have its credentials\n#    automatically rotated, if you implement that feature,\n#    let me known!\nexport VAGRANT_SMB_USERNAME='_vagrant_share'\nexport VAGRANT_SMB_PASSWORD=''\n\n# remove the virtual switch from the windows firewall.\n# NB execute if the VM fails to obtain an IP address from DHCP.\nPowerShell -Command 'Set-NetFirewallProfile -DisabledInterfaceAliases (Get-NetAdapter -name \"vEthernet*\" | Where-Object {$_.ifIndex}).InterfaceAlias'\nEOF\nsource secrets-hyperv.sh\n```\n\nCreate the base box:\n\n```bash\nmake build-hyperv\n```\n\nAdd the base box as suggested in make output:\n\n```bash\nvagrant box add -f proxmox-ve-amd64 proxmox-ve-amd64-hyperv.box\n```\n\nStart the example vagrant environment with:\n\n```bash\ncd example\nvagrant up --provider=hyperv\n```\n\n## VMware vSphere usage\n\nDownload [govc](https://github.com/vmware/govmomi/releases/latest) and place it inside your `/usr/local/bin` directory.\n\nSet your VMware vSphere details and test the connection:\n\n```bash\nsudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev\nvagrant plugin install vagrant-vsphere\ncat \u003esecrets-vsphere.sh \u003c\u003c'EOF'\nexport GOVC_INSECURE='1'\nexport GOVC_HOST='vsphere.local'\nexport GOVC_URL=\"https://$GOVC_HOST/sdk\"\nexport GOVC_USERNAME='administrator@vsphere.local'\nexport GOVC_PASSWORD='password'\nexport GOVC_DATACENTER='Datacenter'\nexport GOVC_CLUSTER='Cluster'\nexport GOVC_DATASTORE='Datastore'\nexport VSPHERE_OS_ISO=\"[$GOVC_DATASTORE] iso/proxmox-ve_8.3-1.iso\"\nexport VSPHERE_ESXI_HOST='esxi.local'\nexport VSPHERE_TEMPLATE_FOLDER='test/templates'\n# NB the VSPHERE_TEMPLATE_NAME last segment MUST match the\n#    builders.vm_name property inside the packer template.\nexport VSPHERE_TEMPLATE_NAME=\"$VSPHERE_TEMPLATE_FOLDER/proxmox-ve-amd64\"\nexport VSPHERE_VM_FOLDER='test'\nexport VSPHERE_VM_NAME='proxmox-ve-example'\n# NB for the nested VMs to access the network, this VLAN port group security\n#    policy MUST be configured to Accept:\n#      Promiscuous mode\n#      Forged transmits\nexport VSPHERE_VLAN='packer'\nexport VSPHERE_IP_WAIT_ADDRESS='0.0.0.0/0'\n# set the credentials that the guest will use\n# to connect to this host smb share.\n# NB you should create a new local user named _vagrant_share\n#    and use that one here instead of your user credentials.\n# NB it would be nice for this user to have its credentials\n#    automatically rotated, if you implement that feature,\n#    let me known!\nexport VAGRANT_SMB_USERNAME='_vagrant_share'\nexport VAGRANT_SMB_PASSWORD=''\nEOF\nsource secrets-vsphere.sh\n# see https://github.com/vmware/govmomi/blob/master/govc/USAGE.md\ngovc version\ngovc about\ngovc datacenter.info # list datacenters\ngovc find # find all managed objects\n```\n\nDownload the Proxmox ISO (you can find the full iso URL in the [proxmox-ve.json](proxmox-ve.json) file) and place it inside the datastore as defined by the `iso_paths` property that is inside the [packer template](proxmox-ve-vsphere.json) file.\n\nSee the [example Vagrantfile](example/Vagrantfile) to see how you could use a cloud-init configuration to configure the VM.\n\nType `make build-vsphere` and follow the instructions.\n\nTry the example guest:\n\n```bash\nsource secrets-vsphere.sh\ncd example\nvagrant up --provider=vsphere --no-destroy-on-error --no-tty\nvagrant ssh\nexit\nvagrant destroy -f\n```\n\n## Packer build performance options\n\nTo improve the build performance you can use the following options.\n\n### Accelerate build time with Apt Caching Proxy\n\nTo speed up package downloads, you can specify an apt caching proxy \n(e.g. [apt-cacher-ng](https://www.unix-ag.uni-kl.de/~bloch/acng/))\nby defining the environment variables `APT_CACHE_HOST` (default: undefined)\nand `APT_CACHE_PORT` (default: 3124).\n\nExample:\n\n```bash\nAPT_CACHE_HOST=10.10.10.100 make build-libvirt\n```\n\n### Decrease disk wear by using temporary memory file-system\n\nTo decrease disk wear (and potentially reduce io times),\nyou can use `/dev/shm` (temporary memory file-system) as `output_directory` for Packer builders.\nYour system must have enough available memory to store the created virtual machine.\n\nExample:\n\n```bash\nPACKER_OUTPUT_BASE_DIR=/dev/shm make build-libvirt\n```\n\nRemember to also define `PACKER_OUTPUT_BASE_DIR` when you run `make clean` afterwards.\n\n## Variables override\n\nSome properties of the virtual machine and the Proxmox VE installation can be overridden.\nTake a look at `proxmox-ve.pkr.hcl`, `variable` blocks, to get an idea which values can be\noverridden. Do not override `iso_url` and `iso_checksum` as the `boot_command`s might be\ntied to a specific Proxmox VE version.\n\nCreate the base box:\n\n```bash\nmake build-libvirt VAR_FILE=example.pkrvars.hcl\n```\n\nThe following content of `example.pkrvars.hcl`:\n\n* sets the initial disk size to 128 GB\n* sets the initial memory to 4 GB\n* sets the Packer output base directory to /dev/shm\n* uses all default shell provisioners (see [`./provisioners`](./provisioners)) and a\n  custom one for german localisation\n\n```hcl\ndisk_size = 128 * 1024\nmemory = 4 * 1024\noutput_base_dir = \"/dev/shm\"\nshell_provisioner_scripts = [\n  \"provisioners/apt_proxy.sh\",\n  \"provisioners/upgrade.sh\",\n  \"provisioners/network.sh\",\n  \"provisioners/localisation-de.sh\",\n  \"provisioners/reboot.sh\",\n  \"provisioners/provision.sh\",\n]\n```\n\n# Packer boot_command\n\nThe Proxmox installation is [automatically configured](https://pve.proxmox.com/wiki/Automated_Installation) using the [`answer.toml` file](answer.toml), but to trigger the automatic installation, this environment has to nudge the default Proxmox installation ISO to use the [`answer.toml` file](answer.toml) through the packer `boot_command` interface. This is quite fragile, so be aware when you change anything. The following table describes the current steps and corresponding answers.\n\n| step                                    | boot_command                                                                               |\n|----------------------------------------:|--------------------------------------------------------------------------------------------|\n| select \"Advanced Options\"               | `\u003cend\u003e\u003center\u003e`                                                                             |\n| select \"Install Proxmox VE (Automated)\" | `\u003cdown\u003e\u003cdown\u003e\u003cdown\u003e\u003center\u003e`                                                                |\n| wait for the shell prompt               | `\u003cwait1m\u003e`                                                                                 |\n| do the installation                     | `proxmox-fetch-answer partition \u003e/run/automatic-installer-answers\u003center\u003e\u003cwait\u003eexit\u003center\u003e` |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fproxmox-ve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frgl%2Fproxmox-ve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fproxmox-ve/lists"}