theko2fi / theko2fi.multipass / 0.3.0 / module / multipass_mount Module to manage directory mapping between host and Multipass virtual machine | "added in version" 0.3.0 of theko2fi.multipass" Authors: Kenneth KOFFI (@theko2fi)theko2fi.multipass.multipass_mount (0.3.0) — module
Install with ansible-galaxy collection install theko2fi.multipass:==0.3.0
collections: - name: theko2fi.multipass version: 0.3.0
Mount a local directory in a Multipass virtual machine.
Unmount a directory from a Multipass virtual machine.
- name: Mount '/root/data' directory from the host to '/root/data' inside the VM named 'healthy-cankerworm' theko2fi.multipass.multipass_mount: name: healthy-cankerworm source: /root/data
- name: Mount '/root/data' to '/tmp' inside the VM theko2fi.multipass.multipass_mount: name: healthy-cankerworm source: /root/data target: /tmp state: present
- name: Unmount '/tmp' directory from the VM theko2fi.multipass.multipass_mount: name: healthy-cankerworm target: /tmp state: absent
- name: Mount directory, set file and folder ownership theko2fi.multipass.multipass_mount: name: healthy-cankerworm source: /root/data target: /tmp state: present type: classic uid_map: - "50:50" - "1000:1000" gid_map: - "50:50"
- name: Unmount all mount points from the 'healthy-cankerworm' VM theko2fi.multipass.multipass_mount: name: healthy-cankerworm state: absent
name: description: - Name of the virtual machine to operate on. required: true type: str type: choices: - classic - native default: classic description: - Specify the type of mount to use. - V(classic) mounts use technology built into Multipass. - V(native) mounts use hypervisor and/or platform specific mounts. type: str state: choices: - absent - present default: present description: - V(absent) Unmount the O(target) mount point from the VM. - V(present) Mount the O(source) directory inside the VM. If the VM is not currently running, the directory will be mounted automatically on next boot. type: str source: description: - Path of the local directory to mount - Use with O(state=present) to mount the local directory inside the VM. required: false type: str target: description: - target mount point (path inside the VM). - If omitted when O(state=present), the mount point will be the same as the source's absolute path. - If omitted when O(state=absent), all mounts will be removed from the named VM. required: false type: str gid_map: default: [] description: - A list of group IDs mapping for use in the mount. - Use the Multipass CLI syntax C(<host>:<instance>). - File and folder ownership will be mapped from <host> to <instance> inside the VM. elements: str type: list uid_map: default: [] description: - A list of user IDs mapping for use in the mount. - Use the Multipass CLI syntax C(<host>:<instance>). - File and folder ownership will be mapped from <host> to <instance> inside the VM. elements: str type: list
result: description: - Empty if O(state=absent). returned: when O(state=present) sample: gid_mappings: - 0:default source_path: /root/tmp uid_mappings: - 0:default type: dict