Ansible-Proxmox-inventory icon indicating copy to clipboard operation
Ansible-Proxmox-inventory copied to clipboard

ansible_host is false

Open bym0 opened this issue 2 years ago • 1 comments

I'm using a LXC Container on Proxmox. IP for the Container is given via DHCP. I thought then the proxmox.py script would be passing on the container name, but instead i get false.

root@ansible-fsn02-p01:/opt/ansible# ansible-inventory -i proxmox.py --host timobergende-fsn02-p01.customer.bit.lan
[DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to allow bad characters in group names by
default, this will change, but still be user configurable on deprecation. This feature will be removed in version 2.10.
 Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
{
    "ansible_host": false,
    "proxmox_cpu": 0.00829948055598936,
    "proxmox_cpus": 1,
    "proxmox_disk": 1656913920,
    "proxmox_diskread": 1372147712,
    "proxmox_diskwrite": 31269146624,
    "proxmox_maxdisk": 10464022528,
    "proxmox_maxmem": 1073741824,
    "proxmox_maxswap": 1073741824,
    "proxmox_mem": 305717248,
    "proxmox_name": "timobergende-fsn02-p01.customer.bit.lan",
    "proxmox_netin": 229495704,
    "proxmox_netout": 947908677,
    "proxmox_pid": 2193,
    "proxmox_status": "running",
    "proxmox_swap": 16945152,
    "proxmox_type": "lxc",
    "proxmox_uptime": 1214787,
    "proxmox_vmid": "120"
}

Is there a way to fix this? Is this because the Container gets their IP by DHCP and therefore the IP is not known to proxmox?

bym0 avatar May 06 '22 09:05 bym0

I had the same issue! See my pull request or use the one from my repo:

https://github.com/standadHD/Ansible-Proxmox-inventory

standadHD avatar Oct 19 '22 18:10 standadHD