hookscript global

jbsk

Renowned Member
Mar 28, 2017
37
5
73
Hello,

I would like to know if there is a global hook feature.

It is possible to set a hook for a VM.
Code:
hookscript: local:snippets/setvf.sh

However, I would like the script to be automatically played for all VMs/CTs.

Best,

Julien
 
How can I industrialize hookscript?

One thing I really don't want to do is have a barbarian crond checking every minute that the hookscript isn't missing.
More seriously, how can I add it automatically via the api or even the terraform telemac/proxmox module?
 
When creating guests via the API, you can specify the hookscript parameter as part of the request. I have never used terraform, so can't comment on that.
 
  • Like
Reactions: jbsk
Basically, I know how I'm going to proceed. I keep ansible to make a template with the hookscript argument.
Then I'll use it in terraform with the option already filled in.

Thanks Fiona.

Best,
 
Hi,
unfortunately, it's not currently possible. For reference: https://bugzilla.proxmox.com/show_bug.cgi?id=1564
This issue relates to the "cluster-wide feature of defaulting to a specific cputype"

The OP is asking how to have a hookscript applied as a wildcard rather than having to add it to each Guest (VM/LXC) hook scripts.

ChatGPT tells me:

️ Current Workarounds​


Since a global hook script isn't currently supported, users have explored alternative methods:
  • Per-VM/CT Hook Scripts: Assigning individual hook scripts to each VM or container.Proxmox Support Forum
  • Systemd Services or Timers: Setting up systemd services or timers on the Proxmox host to monitor VM/container start events and execute desired scripts.

These methods, while functional, may require additional configuration and maintenance.

Other refs:
* https://bugzilla.proxmox.com/show_bug.cgi?id=4639

Martin
 
This issue relates to the "cluster-wide feature of defaulting to a specific cputype"
No, the issue is not specific to the CPU type setting, it's about: Setting cluster wide default options for guests
The OP is asking how to have a hookscript applied as a wildcard rather than having to add it to each Guest (VM/LXC) hook scripts.
The hookscript is configured via an option for guests, so the referenced issue applies.