-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Summary
I'm unable to get the virtualbox inventory using the community.general.virtualbox module.
Issue Type
Bug Report
Component Name
virtualbox
Ansible Version
$ ansible --version
ansible [core 2.13.4]
config file = /home/etienne/playbook/ansible.cfg
configured module search path = ['/home/etienne/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/etienne/.local/lib/python3.8/site-packages/ansible
ansible collection location = /home/etienne/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
jinja version = 3.1.2
libyaml = True
Community.general Version
$ ansible-galaxy collection list community.general
# /usr/lib/python3/dist-packages/ansible_collections
Collection Version
----------------- -------
community.general 4.8.3
# /home/etienne/.ansible/collections/ansible_collections
Collection Version
----------------- -------
community.general 5.6.0 Configuration
$ ansible-config dump --only-changed
ANSIBLE_FORCE_COLOR(/home/etienne/playbook/ansible.cfg) = True
INVENTORY_ENABLED(/home/etienne/playbook/ansible.cfg) = ['host_list', 'script', 'auto', 'yaml', 'ini', 'toml', 'virtualbox']OS / Environment
Ubuntu 20.04
Linux P50 5.15.0-48-generic #54~20.04.1-Ubuntu SMP Thu Sep 1 16:17:26 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Steps to Reproduce
When I try to load a VIrtualBox inventory with the following example:
vbox.yml
---
plugin: virtualboxDoing the following command:
ansible all -i vbox.yml --list -vvvI get:
ansible [core 2.13.4]
config file = /home/etienne/playbook/ansible.cfg
configured module search path = ['/home/etienne/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/etienne/.local/lib/python3.8/site-packages/ansible
ansible collection location = /home/etienne/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
jinja version = 3.1.2
libyaml = True
Using /home/etienne/playbook/ansible.cfg as config file
redirecting (type: inventory) ansible.builtin.virtualbox to community.general.virtualbox
host_list declined parsing /home/etienne/playbook/vbox.yml as it did not pass its verify_file() method
script declined parsing /home/etienne/playbook/vbox.yml as it did not pass its verify_file() method
redirecting (type: inventory) ansible.builtin.virtualbox to community.general.virtualbox
Using inventory plugin 'ansible_collections.community.general.plugins.inventory.virtualbox' to process inventory source '/home/etienne/playbook/vbox.yml'
toml declined parsing /home/etienne/playbook/vbox.yml as it did not pass its verify_file() method
[WARNING]: * Failed to parse /home/etienne/playbook/vbox.yml with auto plugin: 'str' object does not support item assignment
File "/home/etienne/.local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
plugin.parse(self._inventory, self._loader, source, cache=cache)
File "/home/etienne/.local/lib/python3.8/site-packages/ansible/plugins/inventory/auto.py", line 59, in parse
plugin.parse(inventory, loader, path, cache=cache)
File "/home/etienne/.ansible/collections/ansible_collections/community/general/plugins/inventory/virtualbox.py", line 281, in parse
cacheable_results = self._populate_from_source(source_data, using_current_cache)
File "/home/etienne/.ansible/collections/ansible_collections/community/general/plugins/inventory/virtualbox.py", line 192, in _populate_from_source
hostvars[current_host][prevkey][pref_k] = v
[WARNING]: * Failed to parse /home/etienne/playbook/vbox.yml with yaml plugin: Plugin configuration YAML file, not YAML inventory
File "/home/etienne/.local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
plugin.parse(self._inventory, self._loader, source, cache=cache)
File "/home/etienne/.local/lib/python3.8/site-packages/ansible/plugins/inventory/yaml.py", line 114, in parse
raise AnsibleParserError('Plugin configuration YAML file, not YAML inventory')
[WARNING]: * Failed to parse /home/etienne/playbook/vbox.yml with ini plugin: Invalid host pattern '---' supplied, '---' is normally a sign this is a YAML file.
File "/home/etienne/.local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
plugin.parse(self._inventory, self._loader, source, cache=cache)
File "/home/etienne/.local/lib/python3.8/site-packages/ansible/plugins/inventory/ini.py", line 136, in parse
raise AnsibleParserError(e)
[WARNING]: * Failed to parse /home/etienne/playbook/vbox.yml with ansible_collections.community.general.plugins.inventory.virtualbox plugin: 'str' object does not support item assignment
File "/home/etienne/.local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
plugin.parse(self._inventory, self._loader, source, cache=cache)
File "/home/etienne/.ansible/collections/ansible_collections/community/general/plugins/inventory/virtualbox.py", line 281, in parse
cacheable_results = self._populate_from_source(source_data, using_current_cache)
File "/home/etienne/.ansible/collections/ansible_collections/community/general/plugins/inventory/virtualbox.py", line 192, in _populate_from_source
hostvars[current_host][prevkey][pref_k] = v
[WARNING]: Unable to parse /home/etienne/playbook/vbox.yml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
hosts (0):
Where:
[WARNING]: * Failed to parse /home/etienne/playbook/vbox.yml with ansible_collections.community.general.plugins.inventory.virtualbox plugin: 'str' object does not support item assignment
File "/home/etienne/.local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
plugin.parse(self._inventory, self._loader, source, cache=cache)
File "/home/etienne/.ansible/collections/ansible_collections/community/general/plugins/inventory/virtualbox.py", line 281, in parse
cacheable_results = self._populate_from_source(source_data, using_current_cache)
File "/home/etienne/.ansible/collections/ansible_collections/community/general/plugins/inventory/virtualbox.py", line 192, in _populate_from_source
hostvars[current_host][prevkey][pref_k] = v
is what we want.
Expected Results
I would expect to get a valid VirtualBox inventory.
Actual Results
$ ansible all -i vbox.yml --list -vvvv
ansible [core 2.13.4]
config file = /home/etienne/playbook/ansible.cfg
configured module search path = ['/home/etienne/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/etienne/.local/lib/python3.8/site-packages/ansible
ansible collection location = /home/etienne/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
jinja version = 3.1.2
libyaml = True
Using /home/etienne/playbook/ansible.cfg as config file
setting up inventory plugins
redirecting (type: inventory) ansible.builtin.virtualbox to community.general.virtualbox
Loading collection community.general from /home/etienne/.ansible/collections/ansible_collections/community/general
host_list declined parsing /home/etienne/playbook/vbox.yml as it did not pass its verify_file() method
script declined parsing /home/etienne/playbook/vbox.yml as it did not pass its verify_file() method
redirecting (type: inventory) ansible.builtin.virtualbox to community.general.virtualbox
Using inventory plugin 'ansible_collections.community.general.plugins.inventory.virtualbox' to process inventory source '/home/etienne/playbook/vbox.yml'
toml declined parsing /home/etienne/playbook/vbox.yml as it did not pass its verify_file() method
[WARNING]: * Failed to parse /home/etienne/playbook/vbox.yml with auto plugin: 'str' object does not support item assignment
File "/home/etienne/.local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
plugin.parse(self._inventory, self._loader, source, cache=cache)
File "/home/etienne/.local/lib/python3.8/site-packages/ansible/plugins/inventory/auto.py", line 59, in parse
plugin.parse(inventory, loader, path, cache=cache)
File "/home/etienne/.ansible/collections/ansible_collections/community/general/plugins/inventory/virtualbox.py", line 281, in parse
cacheable_results = self._populate_from_source(source_data, using_current_cache)
File "/home/etienne/.ansible/collections/ansible_collections/community/general/plugins/inventory/virtualbox.py", line 192, in _populate_from_source
hostvars[current_host][prevkey][pref_k] = v
[WARNING]: * Failed to parse /home/etienne/playbook/vbox.yml with yaml plugin: Plugin configuration YAML file, not YAML inventory
File "/home/etienne/.local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
plugin.parse(self._inventory, self._loader, source, cache=cache)
File "/home/etienne/.local/lib/python3.8/site-packages/ansible/plugins/inventory/yaml.py", line 114, in parse
raise AnsibleParserError('Plugin configuration YAML file, not YAML inventory')
[WARNING]: * Failed to parse /home/etienne/playbook/vbox.yml with ini plugin: Invalid host pattern '---' supplied, '---' is normally a sign this is a YAML file.
File "/home/etienne/.local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
plugin.parse(self._inventory, self._loader, source, cache=cache)
File "/home/etienne/.local/lib/python3.8/site-packages/ansible/plugins/inventory/ini.py", line 136, in parse
raise AnsibleParserError(e)
[WARNING]: * Failed to parse /home/etienne/playbook/vbox.yml with ansible_collections.community.general.plugins.inventory.virtualbox plugin: 'str' object does not support item assignment
File "/home/etienne/.local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
plugin.parse(self._inventory, self._loader, source, cache=cache)
File "/home/etienne/.ansible/collections/ansible_collections/community/general/plugins/inventory/virtualbox.py", line 281, in parse
cacheable_results = self._populate_from_source(source_data, using_current_cache)
File "/home/etienne/.ansible/collections/ansible_collections/community/general/plugins/inventory/virtualbox.py", line 192, in _populate_from_source
hostvars[current_host][prevkey][pref_k] = v
[WARNING]: Unable to parse /home/etienne/playbook/vbox.yml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
hosts (0):
Code of Conduct
- I agree to follow the Ansible Code of Conduct