Documentation

virtualbox - virtualbox inventory source

Synopsis

  • Get inventory hosts from the local virtualbox installation.
  • Uses a <name>.vbox.yaml (or .vbox.yml) YAML configuration file.
  • The inventory_hostname is always the ‘Name’ of the virtualbox instance.

Parameters

Parameter
Choices/Defaults
Configuration
Comments
cache
Default:
no
ini entries:

[inventory ]
cache = no

env:ANSIBLE_INVENTORY_CACHE
Toggle to enable/disable the caching of the inventory's source data, requires a cache plugin setup to work.
cache_connection
ini entries:

[inventory ]
cache_connection = VALUE

env:ANSIBLE_INVENTORY_CACHE_CONNECTION
Cache connection data or path, read cache plugin documentation for specifics.
cache_plugin
ini entries:

[inventory ]
cache_plugin = VALUE

env:ANSIBLE_INVENTORY_CACHE_PLUGIN
Cache plugin to use for the inventory's source data.
cache_timeout
Default:
3600
ini entries:

[inventory ]
cache_timeout = 3600

env:ANSIBLE_INVENTORY_CACHE_TIMEOUT
Cache duration in seconds
compose
Default:
{}
create vars from jinja2 expressions
groups
Default:
{}
add hosts to group based on Jinja2 conditionals
keyed_groups
Default:
[]
add hosts to group based on the values of a variable
network_info_path
Default:
/VirtualBox/GuestInfo/Net/0/V4/IP
property path to query for network information (ansible_host)
query
Default:
{}
create vars from virtualbox properties
running_only
Default:
no
toggles showing all vms vs only those currently running
settings_password_file
provide a file containing the settings password (equivalent to --settingspwfile)
strict
Default:
no
If true make invalid entries a fatal error, otherwise skip and continue
Since it is possible to use facts in the expressions they might not always be available and we ignore those errors by default.

Examples

# file must be named vbox.yaml or vbox.yml
simple_config_file:
    plugin: virtualbox
    settings_password_file: /etc/virtulbox/secrets
    query:
      logged_in_users: /VirtualBox/GuestInfo/OS/LoggedInUsersList
    compose:
      ansible_connection: ('indows' in vbox_Guest_OS)|ternary('winrm', 'ssh')

Status

Author

  • UNKNOWN

Hint

If you notice any issues in this documentation you can edit this document to improve it.