Repository: ansible-collections/community.general

Issue:
add hookscript parameter to proxmox_kvm
### Summary

I would like to add the config `hookscript` parameter which is not exposed via the proxmox_kvm module.


### Issue Type

Feature Idea

### Component Name

proxmox_kvm

### Additional Information

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
- name: Create new VM with minimal options and hookscript
  community.general.proxmox_kvm:
    # existing params
    api_user: root@pam
    api_password: secret
    api_host: helldorado
    name: spynal
    node: sabrewulf
    # this param is new:
    hookscript: local:snippets/myhook.py
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
add hookscript parameter to proxmox_kvm
### Summary

I would like to add the config `hookscript` parameter which is not exposed via the proxmox_kvm module.


### Issue Type

Feature Idea

### Component Name

proxmox_kvm

### Additional Information

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
- name: Create new VM with minimal options and hookscript
  community.general.proxmox_kvm:
    # existing params
    api_user: root@pam
    api_password: secret
    api_host: helldorado
    name: spynal
    node: sabrewulf
    # this param is new:
    hookscript: local:snippets/myhook.py
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:
Files identified in the description:
* [`plugins/modules/proxmox_kvm.py`](https://github.com/ansible-collections/community.general/blob/main/plugins/modules/proxmox_kvm.py)

If these files are incorrect, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @Ajpantuso @Thulium-Drake @UnderGreen @helldorado @joshainglis @karmab
[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: notify --->
I'll submit a PR soon.
Files identified in the description:
* [`plugins/modules/proxmox_kvm.py`](https://github.com/ansible-collections/community.general/blob/main/plugins/modules/proxmox_kvm.py)

If these files are incorrect, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @Ajpantuso @Thulium-Drake @UnderGreen @helldorado @joshainglis @karmab
[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: notify --->
I'll submit a PR soon.

Resolving patch:
diff --git a/plugins/modules/proxmox_kvm.py b/plugins/modules/proxmox_kvm.py
--- a/plugins/modules/proxmox_kvm.py
+++ b/plugins/modules/proxmox_kvm.py
@@ -196,6 +196,11 @@
       - Used only with clone
     type: bool
     default: true
+  hookscript:
+    description:
+      - Script that will be executed during various steps in the containers lifetime.
+    type: str
+    version_added: 8.1.0
   hostpci:
     description:
       - Specify a hash/dictionary of map host pci devices into guest. O(hostpci='{"key":"value", "key":"value"}').
@@ -867,6 +872,17 @@
     name: spynal
     node: sabrewulf-2
     migrate: true
+
+- name: Add hookscript to existing VM
+  community.general.proxmox_kvm:
+    api_user: root@pam
+    api_password: secret
+    api_host: helldorado
+    vmid: 999
+    node: sabrewulf
+    hookscript: local:snippets/hookscript.pl
+    update: true
+
 '''
 
 RETURN = '''
@@ -1214,6 +1230,7 @@ def main():
         format=dict(type='str', choices=['cloop', 'cow', 'qcow', 'qcow2', 'qed', 'raw', 'vmdk', 'unspecified']),
         freeze=dict(type='bool'),
         full=dict(type='bool', default=True),
+        hookscript=dict(type='str'),
         hostpci=dict(type='dict'),
         hotplug=dict(type='str'),
         hugepages=dict(choices=['any', '2', '1024']),
@@ -1432,6 +1449,7 @@ def main():
                               efidisk0=module.params['efidisk0'],
                               force=module.params['force'],
                               freeze=module.params['freeze'],
+                              hookscript=module.params['hookscript'],
                               hostpci=module.params['hostpci'],
                               hotplug=module.params['hotplug'],
                               hugepages=module.params['hugepages'],


Test patch: