Hello,
I'm dealing with proxmox inventory source in ansible. I have collection
As I learned from community.proxmox.proxmox inventory docs, We are able to set
I have my
If I set
So inventory somehow managed to get access to network interface as we can check with
How can I access my physical machine
Idea would be to do something like this
So how can we access this full network configuration (especially
I want to then do some parsing in my inventory of the infos retrieved from
I'm dealing with proxmox inventory source in ansible. I have collection
community.proxmox
in it's latest version 1.3.0
.As I learned from community.proxmox.proxmox inventory docs, We are able to set
ansible_host
with compose
.I have my
ansible.cfg
:
Code:
[defaults]
inventory = /root/foo/.proxmox.yml
fact_caching = memory
retry_files_enabled = False
host_key_checking = False
forks = 5
[inventory]
cache = false
[ssh_connection]
pipelining = True
host_key_auto_add = True
ssh_args = -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
If I set
want_proxmox_nodes_ansible_host: true
then ansible_host
is set by accessing network configuration somehow of my distant physical pve
machine, but I'm of course unable to control this var:
Code:
plugin: community.proxmox.proxmox
url: https://192.168.2.1:8006
user: root@pam
password: '<REDACTED>'
validate_certs: false
want_facts: true
want_proxmox_nodes_ansible_host: true
#compose:
# ansible_host: "'127.0.0.1'"
So inventory somehow managed to get access to network interface as we can check with
ansible-inventory -vvvvv
:
Code:
root@ansible:~/foo# ANSIBLE_CACHE_PLUGIN=memory ansible-inventory -i .proxmox.yml --host pve --yaml --vars -vvvvv
ansible-inventory [core 2.17.13]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible-inventory
python version = 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
Loading collection ansible.builtin from
host_list declined parsing /root/foo/.proxmox.yml as it did not pass its verify_file() method
script declined parsing /root/foo/.proxmox.yml as it did not pass its verify_file() method
Loading collection community.proxmox from /root/.ansible/collections/ansible_collections/community/proxmox
Using inventory plugin 'ansible_collections.community.proxmox.plugins.inventory.proxmox' to process inventory source '/root/foo/.proxmox.yml'
Interface enp10s0 on node pve does not have an active state
Interface enp4s0 on node pve does not have an active state
Interface enp6s0 on node pve does not have an address
Interface enp7s0 on node pve does not have an address
Interface enp8s0 on node pve does not have an active state
Interface enp9s0 on node pve does not have an active state
Interface enx00e04c3cc0b3 on node pve does not have an active state
Using interface vmbr10 on node pve with address 192.168.2.1 as node ip for ansible_host
Parsed /root/foo/.proxmox.yml inventory source with auto plugin
"ansible_host": "192.168.2.1"
How can I access my physical machine
pve
network interface configuration in my ansible inventory ? (I do no want to use playbook for it)Idea would be to do something like this
/root/foo/.proxmox.yml
( I have want_proxmox_nodes_ansible_host: false
and I'm setting here a static value to ansible_host
for a simple example):
Code:
plugin: community.proxmox.proxmox
url: https://192.168.2.1:8006
user: root@pam
password: '<REDACTED>'
validate_certs: false
want_facts: true
want_proxmox_nodes_ansible_host: false
compose:
ansible_host: "'127.0.0.1'"
So how can we access this full network configuration (especially
vmbr10
) WITHOUT having want_proxmox_nodes_ansible_host: true
? I want to then do some parsing in my inventory of the infos retrieved from
vmbr10
conf to set ansible_host
with compose
.
Last edited: