theko2fi.multipass.multipass_vm module – Module to manage Multipass VM
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
.
Synopsis
Manage the life cycle of Multipass virtual machines (create, start, stop, delete).
Parameters
Parameter |
Comments |
---|---|
Path or URL to a user-data cloud-init configuration. Default: |
|
The number of CPUs of the VM. |
|
Disk space to allocate to the VM in format Positive integers, in bytes, or with Omitting the unit defaults to bytes. Default: |
|
The image used to create the VM. Default: |
|
The amount of RAM to allocate to the VM. Default: |
|
Specification for mounts to be added to the VM. Omitting a mount that is currently applied to a VM will remove it. |
|
A list of group IDs mapping for use in the mount. Use the Multipass CLI syntax Omitting an gid_map that is currently applied to a mount, will remove it. |
|
Path of the local directory to mount. |
|
target mount point (path inside the VM). If omitted, the mount point will be the same as the source’s absolute path. |
|
Specify the type of mount to use.
Choices:
|
|
A list of user IDs mapping for use in the mount. Use the Multipass CLI syntax Omitting an uid_map that is currently applied to a mount, will remove it. |
|
Name for the VM. If it is |
|
Use with Choices:
|
|
Use the Choices:
|
Examples
- name: Create a VM with default parameters
theko2fi.multipass.multipass_vm:
name: foo
- name: Create a VM with custom specs
theko2fi.multipass.multipass_vm:
name: foo
cpus: 2
memory: 2G
disk: 5G
- name: Stop a VM
theko2fi.multipass.multipass_vm:
name: foo
state: stopped
- name: Start a VM
theko2fi.multipass.multipass_vm:
name: foo
state: started
- name: Recreate a VM
theko2fi.multipass.multipass_vm:
name: foo
cpus: 4
memory: 2G
disk: 10G
recreate: true
- name: Delete a VM
theko2fi.multipass.multipass_vm:
name: foo
state: absent
- name: Delete and purge a VM
theko2fi.multipass.multipass_vm:
name: foo
state: absent
purge: true
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Facts representing the current state of the virtual machine. Matches the multipass info output. Empty if Will be Returned: success; or when Sample: |