community.general
community.general copied to clipboard
Proxmox - Specifiying mounts causes LXC creation to fail
Summary
Specifying mounts as part of community.general.proxmox
causes the LXC container creation to fail.
Excluding the mounts
specification allows the container to be created. I have tried various different storage types and different ways of specifying the dict, but none have worked thus far.
Issue Type
Bug Report
Component Name
proxmox
Ansible Version
$ ansible --version
ansible [core 2.12.4]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.10/site-packages/ansible
ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0]
jinja version = 3.0.3
libyaml = True
Community.general Version
$ ansible-galaxy collection list community.general
# /usr/lib/python3.10/site-packages/ansible_collections
Collection Version
----------------- -------
community.general 4.7.0
Configuration
No response
OS / Environment
Proxmox 7.1-12
Steps to Reproduce
- name: Setup bootstrap server
hosts: localhost
become: false
tasks:
- name: Create bootstrap-srv LXC container
community.general.proxmox:
api_user: "api_user"
api_host: "pve01"
api_token_id: "ansible"
api_token_secret: "secret"
vmid: 220
description: Bootstrap LXC container
password: "password"
node: "pve01"
cores: 1
cpus: 1
memory: 3072
hostname: bootstrap-srv
netif:
net0: "name=eth0,gw=10.100.100.1,ip=10.100.100.22/24,bridge=vmbr0"
nameserver: "10.100.100.5"
searchdomain: "example.com"
ostemplate: "cephfs:vztmpl/ubuntu-20.04-standard_20.04-1_amd64.tar.gz"
mounts:
mp0: "CephVMs:6,mp=/data"
storage: "CephVMs"
pubkey: "{{ ssh_pubkey }}"
state: present
timeout: 90
unprivileged: true
Expected Results
Expected the LXC container to be created with the specified mount: /data mount point within the container, 6GB of space allocated, stored on the "CephVM" storage location
Actual Results
The full traceback is:
File "/tmp/ansible_community.general.proxmox_payload_boh76q8u/ansible_community.general.proxmox_payload.zip/ansible_collections/community/general/plugins/modules/proxmox.py", line 653, in main
File "/tmp/ansible_community.general.proxmox_payload_boh76q8u/ansible_community.general.proxmox_payload.zip/ansible_collections/community/general/plugins/modules/proxmox.py", line 480, in create_instance
File "/home/user/.local/lib/python3.10/site-packages/proxmoxer/core.py", line 155, in create
return self.post(*args, **data)
File "/home/user/.local/lib/python3.10/site-packages/proxmoxer/core.py", line 146, in post
return self(args)._request("POST", data=data)
File "/home/user/.local/lib/python3.10/site-packages/proxmoxer/core.py", line 129, in _request
errors=(self._store["serializer"].loads_errors(resp) or {}),
File "/home/user/.local/lib/python3.10/site-packages/proxmoxer/backends/https.py", line 180, in loads_errors
return json.loads(response.text)["errors"]
fatal: [localhost]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"api_host": "pve01",
"api_password": null,
"api_token_id": "ansible",
"api_token_secret": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"api_user": "api_user",
"clone": null,
"clone_type": "opportunistic",
"cores": 1,
"cpus": 1,
"cpuunits": null,
"description": "Bootstrap LXC container",
"disk": null,
"features": null,
"force": false,
"hookscript": null,
"hostname": "bootstrap-srv",
"ip_address": null,
"memory": 3072,
"mounts": {
"mp0": "CephVMs:6,mp=/data"
},
"nameserver": "10.100.100.5",
"netif": {
"net0": "name=eth0,gw=10.100.100.1,ip=10.100.100.121/24,bridge=vmbr0"
},
"node": "pve01",
"onboot": null,
"ostemplate": "cephfs:vztmpl/ubuntu-20.04-standard_20.04-1_amd64.tar.gz",
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"pool": null,
"proxmox_default_behavior": "no_defaults",
"pubkey": "ecdsa-sha2-nistp384 REDACTED",
"purge": false,
"searchdomain": "example.com",
"state": "present",
"storage": "containers",
"swap": null,
"timeout": 90,
"unprivileged": true,
"validate_certs": false,
"vmid": 220
}
},
"msg": "Creation of lxc VM 220 failed with exception: 'errors'"
}
Code of Conduct
- [X] I agree to follow the Ansible Code of Conduct
Files identified in the description:
-
plugins/modules/cloud/misc/proxmox
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
cc @Ajpantuso @Thulium-Drake @joshainglis @karmab @tleguern click here for bot help
This happens because of restrictions in the Proxmox API (docs, PUT tab).
In version 5.
this returns a proper error message in ansible.
Long story short you can not edit mountpoints configs unless you authenticate as root@pam
with api_password
set.
I haven't had luck with API tokens either.
EDIT: nevermind, this shouldn't happen, since the restriction is for non-volume mount points only
Files identified in the description:
-
plugins/modules/proxmox
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.