Problem:
Using the Ansible collection theforeman.foreman (current v2.2) it’s not possible to create a VM via Foreman (3.0.0-rc2) using Proxmox (v6.4).
The error message is: “vmid is required for this operation”.
There is no vmid which could be passed as parameter, so the plugin foreman-fog-proxmox (v 0.14) might not get the next free vmid from Proxmox.
There is a quite old bug similar to this: https://github.com/theforeman/foreman_fog_proxmox/issues/83
It looks like the foreman-fog-proxmox does not get the next free vmid from Proxmox.
Is this a known issue?
Kind regards,
Anhu
Foreman and Proxy versions:
foreman 3.0.0~rc2-1
foreman-assets 3.0.0~rc2-1
foreman-cli 3.0.0~rc2-1
foreman-debug 3.0.0~rc2-1
foreman-dynflow-sidekiq 3.0.0~rc2-1
foreman-installer 3.0.0~rc2-1
foreman-postgresql 3.0.0~rc2-1
foreman-proxy 3.0.0~rc2-1
foreman-service 3.0.0~rc2-1
ruby-foreman-ansible 9999-plugin+scratchbuild+20210716145329
ruby-foreman-deface 1.5.3-1
ruby-foreman-fog-proxmox 0.14 (manually installed!)
ruby-foreman-puppet 1.0.0~rc2-1
ruby-foreman-remote-execution 9999-plugin+scratchbuild+20210715153232
ruby-foreman-tasks 5.0.0-1
ruby-foreman-tasks-core 0.4.0-1
ruby-foreman-templates 9.0.0-1
ruby-hammer-cli-foreman 3.0.0-1
ruby-hammer-cli-foreman-puppet 0.0.3-2
Distribution and version:
Debian 10
Other relevant data:
(with some data protection values aka my…)
The full traceback is:
File "/tmp/ansible_theforeman.foreman.host_payload_ie_6hlex/ansible_theforeman.foreman.host_payload.zip/ansible_collections/theforeman/foreman/plugins/module_utils/foreman_helper.py", line 1190, in resource_action
result = self._resource_call(resource, action, resource_payload, options=options, data=data, files=files)
File "/tmp/ansible_theforeman.foreman.host_payload_ie_6hlex/ansible_theforeman.foreman.host_payload.zip/ansible_collections/theforeman/foreman/plugins/module_utils/foreman_helper.py", line 674, in _resource_call
return self._resource(resource).call(*args, **kwargs)
File "/tmp/ansible_theforeman.foreman.host_payload_ie_6hlex/ansible_theforeman.foreman.host_payload.zip/ansible_collections/theforeman/foreman/plugins/module_utils/_apypie.py", line 864, in call
return self.api.call(self.name, action, params, headers, options, data, files)
File "/tmp/ansible_theforeman.foreman.host_payload_ie_6hlex/ansible_theforeman.foreman.host_payload.zip/ansible_collections/theforeman/foreman/plugins/module_utils/_apypie.py", line 482, in call
return self._call_action(action, params, headers, data, files)
File "/tmp/ansible_theforeman.foreman.host_payload_ie_6hlex/ansible_theforeman.foreman.host_payload.zip/ansible_collections/theforeman/foreman/plugins/module_utils/_apypie.py", line 494, in _call_action
headers, data, files)
File "/tmp/ansible_theforeman.foreman.host_payload_ie_6hlex/ansible_theforeman.foreman.host_payload.zip/ansible_collections/theforeman/foreman/plugins/module_utils/_apypie.py", line 532, in http_call
request.raise_for_status()
File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
fatal: [myforeman]: FAILED! => {
"changed": false,
"error": {
"errors": {
"base": [
"Failed to create a compute My-Proxmox (Proxmox) instance host01.mydomain: vmid is required for this operation\n "
]
},
"full_messages": [
"Failed to create a compute My-Proxmox (Proxmox) instance host01.mydomain: vmid is required for this operation\n "
],
"id": null
},
"invocation": {
"module_args": {
"activation_keys": null,
"architecture": null,
"build": true,
"comment": null,
"compute_attributes": null,
"compute_profile": null,
"compute_resource": null,
"config_groups": null,
"content_source": null,
"content_view": null,
"domain": null,
"enabled": null,
"environment": null,
"hostgroup": "myhostgroup01",
"image": null,
"interfaces_attributes": null,
"ip": null,
"kickstart_repository": null,
"lifecycle_environment": null,
"location": "Myplace",
"mac": null,
"managed": null,
"medium": null,
"name": "host01.mydomain",
"openscap_proxy": null,
"operatingsystem": null,
"organization": "My Organization",
"owner": null,
"owner_group": null,
"parameters": null,
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"provision_method": null,
"ptable": null,
"puppet_ca_proxy": null,
"puppet_proxy": null,
"puppetclasses": null,
"pxe_loader": null,
"realm": null,
"root_pass": null,
"server_url": "https://myforemanhost.mydomain",
"state": "present",
"subnet": null,
"subnet6": null,
"username": "ansible",
"validate_certs": false
}
},
"msg": "Error while performing create on hosts: 422 Client Error: Unprocessable Entity for url: https://myforemanhost.mydomain/api/hosts"
}