theko2fi.multipass.multipass_vm_info module – Retrieves facts about Multipass virtual machine

Note

This module is part of the theko2fi.multipass collection (version 0.3.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install theko2fi.multipass.

To use it in a playbook, specify: theko2fi.multipass.multipass_vm_info.

Synopsis

  • Retrieves facts about a Multipass virtual machine.

  • Essentially returns the output of multipass info <name>, similar to what theko2fi.multipass.multipass_vm returns for a non-absent virtual machine.

Parameters

Parameter

Comments

name

string / required

The name of the virtual machine to inspect.

Examples

- name: Get infos on virtual machine
  theko2fi.multipass.multipass_vm_info:
    name: foo
  register: output

- name: Does virtual machine exist?
  ansible.builtin.debug:
    msg: "The VM {{ 'exists' if output.exists else 'does not exist' }}"

- name: Print information about virtual machine
  ansible.builtin.debug:
    var: output.result
  when: output.exists

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

exists

boolean

Returns whether the virtual machine exists.

Returned: always

Sample: true

result

dictionary

Facts representing the current state of the virtual machine. Matches the multipass info output.

Will be none if virtual machine does not exist.

Returned: always

Sample: {"errors": [], "info": {"foo": {"cpu_count": "1", "disks": {"sda1": {"total": "5120710656", "used": "2200540672"}}, "image_hash": "fe102bfb3d3d917d31068dd9a4bd8fcaeb1f529edda86783f8524fdc1477ee29", "image_release": "22.04 LTS", "ipv4": ["172.23.240.92"], "load": [0.01, 0.01, 0], "memory": {"total": 935444480, "used": 199258112}, "mounts": {}, "release": "Ubuntu 22.04.2 LTS", "state": "Running"}}}

Authors

  • Kenneth KOFFI (@theko2fi)