https://github.com/badsmoke/proxmox-auto-hostname
change vm hostname automatic to vm-name
https://github.com/badsmoke/proxmox-auto-hostname
hostname proxmox vm
Last synced: 5 months ago
JSON representation
change vm hostname automatic to vm-name
- Host: GitHub
- URL: https://github.com/badsmoke/proxmox-auto-hostname
- Owner: badsmoke
- Created: 2021-01-26T16:15:32.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-11-21T07:01:18.000Z (over 2 years ago)
- Last Synced: 2023-11-21T08:23:55.847Z (over 2 years ago)
- Topics: hostname, proxmox, vm
- Language: Shell
- Homepage:
- Size: 9.77 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# proxmox-auto-hostname
change vm hostname automatic to vm-name
## what can it do?
the script fetches its vm-name via api and changes it to this one
for operating systems that use "cloud-init" you can simply put the script into the folder
`/var/lib/cloud/scripts/per-boot/` and it will be executed on every boot.
for all others you could also just create a cronjob
`@reboot /path/to/script/vm-boot.sh`
don't forget to make the script executable
`chmod +x vm-boot.sh`
a proxmox user must be created who has at least read rights to the api/vms
## how does it work
the script retrieves its vm-name with the help of the mac address and the proxmox api
first fetches the mac address from each interface
Then the script connects to the api of proxmox and goes through all clusters, vm and their network interface and compares the mac addresses with each other, if the mac addresses match the corresponding vm-name is chosen and set
## Dependencies
`curl jq`