Hello Proxmox Team,
recently i'm trying to setup my lab through ansible.
I found the ansibe collection community.general that has a proxmox_kvm module which seems to work pretty well for this.
I switched the the API from providing my root password to using a PVE API Token for root@pam.
I had hoped that later on i could just enable the Privilege Separation and limit the token to vm creation.
But it seems that certain problems arise when doing this.
Problem:
When switching to API Tokens for the root user the proxmox_kvm module dies with a 500 Error "Only root can set args".
This is a clearly a fault in the proxmox_kvm module as noted here: https://github.com/ansible-collections/community.general/issues/1641
and i already provided a temp fix for that. (Happens because the module always appends the args param... even if explicitly set to None)
After that i ported the hookscript parameter into the kvm module (only exists currenty in the container module) just to find that this produce a new 500 Error "Only root can set hookscript"...
Questions to you:
Thank you very much for your response and the splendid work on PVE
PS: This is my ticket response... should be all the necessary permissions? ie. currently for developing purpose i have disabled the Privilege Separation for the root@pam Token.
recently i'm trying to setup my lab through ansible.
I found the ansibe collection community.general that has a proxmox_kvm module which seems to work pretty well for this.
I switched the the API from providing my root password to using a PVE API Token for root@pam.
I had hoped that later on i could just enable the Privilege Separation and limit the token to vm creation.
But it seems that certain problems arise when doing this.
Problem:
When switching to API Tokens for the root user the proxmox_kvm module dies with a 500 Error "Only root can set args".
This is a clearly a fault in the proxmox_kvm module as noted here: https://github.com/ansible-collections/community.general/issues/1641
and i already provided a temp fix for that. (Happens because the module always appends the args param... even if explicitly set to None)
After that i ported the hookscript parameter into the kvm module (only exists currenty in the container module) just to find that this produce a new 500 Error "Only root can set hookscript"...
Questions to you:
- Could you kindly confirm that using API Tokens for the root account instead of a password indeed uses a different code path in the API - i.e. that this is an expected behaviour on your end? If so i would gladly provide a patch to the ansible module so it exits with a more descriptive error message, currently it only checks for the account name.... not if a token was used for authentication
- I also found the following params which also seem to have this error appear:
"spice_enhancements": "foldersharing=1", "vmgenid": "1", "rng0": "/dev/urandom", "keephugepages": 1, "hostpci0": "host=00:02.0", "args": "-serial unix:/var/run/qemu-server/211.serial,server,nowait", "hookscript": "local:snippets/myhook.sh", "hugepages": "any", "arch": "x86_64", "lock": "backup", "ivshmem": "size=2",
- did i miss any?
- Im currently not using containers but, could you confirm that this would apply to the container API Endpoint aswell? I will probably provide a pull request for that module aswell then.
- I can see some parameters are deprecated that are still used in the ansible module, is there some sort of versioning behind the Proxmox API? I.e. can i find out in which pve version a param was added or removed?
Thank you very much for your response and the splendid work on PVE
PS: This is my ticket response... should be all the necessary permissions? ie. currently for developing purpose i have disabled the Privilege Separation for the root@pam Token.
> GET /api2/json/access/permissions HTTP/1.1
> Host: nas:8006
> User-Agent: insomnia/2020.5.2
> Authorization: PVEAPIToken=root@pam!ansible=38c6bf63-************
> Accept: */*
JSON:
{
"data": {
"/vms": {
"Sys.Console": 1,
"SDN.Allocate": 1,
"Group.Allocate": 1,
"VM.Config.Cloudinit": 1,
"VM.Allocate": 1,
"Sys.Modify": 1,
"VM.Audit": 1,
"VM.Console": 1,
"Sys.Audit": 1,
"Datastore.Allocate": 1,
"VM.Backup": 1,
"Datastore.Audit": 1,
"Realm.AllocateUser": 1,
"Datastore.AllocateSpace": 1,
"VM.Migrate": 1,
"VM.Config.Network": 1,
"Realm.Allocate": 1,
"VM.Config.HWType": 1,
"Sys.Syslog": 1,
"VM.Config.CDROM": 1,
"VM.Monitor": 1,
"VM.Config.Disk": 1,
"VM.Config.Memory": 1,
"VM.Config.Options": 1,
"VM.Clone": 1,
"VM.Snapshot": 1,
"SDN.Audit": 1,
"Permissions.Modify": 1,
"VM.Snapshot.Rollback": 1,
"Pool.Allocate": 1,
"VM.Config.CPU": 1,
"User.Modify": 1,
"VM.PowerMgmt": 1,
"Sys.PowerMgmt": 1,
"Datastore.AllocateTemplate": 1
},
"/nodes": {
"VM.Config.HWType": 1,
"Sys.Syslog": 1,
"VM.Config.CDROM": 1,
"VM.Config.Disk": 1,
"VM.Config.Memory": 1,
"VM.Monitor": 1,
"VM.Config.Options": 1,
"VM.Clone": 1,
"VM.Snapshot": 1,
"SDN.Audit": 1,
"Pool.Allocate": 1,
"VM.Snapshot.Rollback": 1,
"Permissions.Modify": 1,
"User.Modify": 1,
"VM.Config.CPU": 1,
"VM.PowerMgmt": 1,
"Sys.PowerMgmt": 1,
"Datastore.AllocateTemplate": 1,
"Sys.Console": 1,
"Group.Allocate": 1,
"SDN.Allocate": 1,
"VM.Config.Cloudinit": 1,
"Sys.Modify": 1,
"VM.Allocate": 1,
"VM.Audit": 1,
"VM.Console": 1,
"Datastore.Allocate": 1,
"Sys.Audit": 1,
"VM.Backup": 1,
"Datastore.Audit": 1,
"Realm.AllocateUser": 1,
"Datastore.AllocateSpace": 1,
"VM.Migrate": 1,
"Realm.Allocate": 1,
"VM.Config.Network": 1
},
"/storage": {
"VM.Config.Options": 1,
"VM.Config.Disk": 1,
"VM.Config.Memory": 1,
"VM.Monitor": 1,
"VM.Config.CDROM": 1,
"Sys.Syslog": 1,
"VM.Config.HWType": 1,
"Datastore.AllocateTemplate": 1,
"Sys.PowerMgmt": 1,
"VM.PowerMgmt": 1,
"User.Modify": 1,
"VM.Config.CPU": 1,
"VM.Snapshot.Rollback": 1,
"Pool.Allocate": 1,
"Permissions.Modify": 1,
"VM.Snapshot": 1,
"SDN.Audit": 1,
"VM.Clone": 1,
"VM.Audit": 1,
"Sys.Modify": 1,
"VM.Allocate": 1,
"VM.Config.Cloudinit": 1,
"Group.Allocate": 1,
"SDN.Allocate": 1,
"Sys.Console": 1,
"VM.Config.Network": 1,
"Realm.Allocate": 1,
"VM.Migrate": 1,
"Datastore.AllocateSpace": 1,
"Realm.AllocateUser": 1,
"Datastore.Audit": 1,
"VM.Backup": 1,
"Datastore.Allocate": 1,
"Sys.Audit": 1,
"VM.Console": 1
},
"/access": {
"Pool.Allocate": 1,
"VM.Snapshot.Rollback": 1,
"Permissions.Modify": 1,
"VM.Clone": 1,
"SDN.Audit": 1,
"VM.Snapshot": 1,
"Sys.PowerMgmt": 1,
"Datastore.AllocateTemplate": 1,
"User.Modify": 1,
"VM.Config.CPU": 1,
"VM.PowerMgmt": 1,
"VM.Config.CDROM": 1,
"VM.Config.Memory": 1,
"VM.Config.Disk": 1,
"VM.Monitor": 1,
"VM.Config.HWType": 1,
"Sys.Syslog": 1,
"VM.Config.Options": 1,
"Datastore.Allocate": 1,
"Sys.Audit": 1,
"VM.Backup": 1,
"VM.Console": 1,
"VM.Config.Network": 1,
"Realm.Allocate": 1,
"Datastore.Audit": 1,
"Realm.AllocateUser": 1,
"Datastore.AllocateSpace": 1,
"VM.Migrate": 1,
"VM.Config.Cloudinit": 1,
"Sys.Modify": 1,
"VM.Allocate": 1,
"Sys.Console": 1,
"Group.Allocate": 1,
"SDN.Allocate": 1,
"VM.Audit": 1
},
"/": {
"Pool.Allocate": 1,
"VM.Snapshot.Rollback": 1,
"Permissions.Modify": 1,
"VM.Clone": 1,
"SDN.Audit": 1,
"VM.Snapshot": 1,
"Sys.PowerMgmt": 1,
"Datastore.AllocateTemplate": 1,
"User.Modify": 1,
"VM.Config.CPU": 1,
"VM.PowerMgmt": 1,
"VM.Config.CDROM": 1,
"VM.Config.Memory": 1,
"VM.Config.Disk": 1,
"VM.Monitor": 1,
"VM.Config.HWType": 1,
"Sys.Syslog": 1,
"VM.Config.Options": 1,
"Datastore.Allocate": 1,
"Sys.Audit": 1,
"VM.Backup": 1,
"VM.Console": 1,
"VM.Config.Network": 1,
"Realm.Allocate": 1,
"Datastore.AllocateSpace": 1,
"Realm.AllocateUser": 1,
"Datastore.Audit": 1,
"VM.Migrate": 1,
"VM.Config.Cloudinit": 1,
"Sys.Modify": 1,
"VM.Allocate": 1,
"Sys.Console": 1,
"Group.Allocate": 1,
"SDN.Allocate": 1,
"VM.Audit": 1
},
"/pools": {
"VM.Console": 1,
"Datastore.Allocate": 1,
"Sys.Audit": 1,
"VM.Backup": 1,
"Realm.AllocateUser": 1,
"Datastore.Audit": 1,
"Datastore.AllocateSpace": 1,
"VM.Migrate": 1,
"VM.Config.Network": 1,
"Realm.Allocate": 1,
"Sys.Console": 1,
"Group.Allocate": 1,
"SDN.Allocate": 1,
"VM.Config.Cloudinit": 1,
"Sys.Modify": 1,
"VM.Allocate": 1,
"VM.Audit": 1,
"VM.Clone": 1,
"VM.Snapshot": 1,
"SDN.Audit": 1,
"VM.Snapshot.Rollback": 1,
"Pool.Allocate": 1,
"Permissions.Modify": 1,
"User.Modify": 1,
"VM.Config.CPU": 1,
"VM.PowerMgmt": 1,
"Sys.PowerMgmt": 1,
"Datastore.AllocateTemplate": 1,
"VM.Config.HWType": 1,
"Sys.Syslog": 1,
"VM.Config.CDROM": 1,
"VM.Config.Disk": 1,
"VM.Config.Memory": 1,
"VM.Monitor": 1,
"VM.Config.Options": 1
},
"/access/groups": {
"Datastore.Allocate": 1,
"Sys.Audit": 1,
"VM.Backup": 1,
"VM.Console": 1,
"VM.Config.Network": 1,
"Realm.Allocate": 1,
"Realm.AllocateUser": 1,
"Datastore.Audit": 1,
"Datastore.AllocateSpace": 1,
"VM.Migrate": 1,
"VM.Config.Cloudinit": 1,
"Sys.Modify": 1,
"VM.Allocate": 1,
"Sys.Console": 1,
"Group.Allocate": 1,
"SDN.Allocate": 1,
"VM.Audit": 1,
"VM.Snapshot.Rollback": 1,
"Pool.Allocate": 1,
"Permissions.Modify": 1,
"VM.Clone": 1,
"SDN.Audit": 1,
"VM.Snapshot": 1,
"Sys.PowerMgmt": 1,
"Datastore.AllocateTemplate": 1,
"User.Modify": 1,
"VM.Config.CPU": 1,
"VM.PowerMgmt": 1,
"VM.Config.CDROM": 1,
"VM.Config.Memory": 1,
"VM.Config.Disk": 1,
"VM.Monitor": 1,
"VM.Config.HWType": 1,
"Sys.Syslog": 1,
"VM.Config.Options": 1
}
}
}
}
Last edited: