theko2fi.multipass.multipass_vm_transfer_into module – Copy a file into a 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_transfer_into.

New in theko2fi.multipass 0.2.0

Synopsis

  • Copy a file into a Multipass virtual machine.

  • Similar to multipass transfer.

Parameters

Parameter

Comments

content

string

The file’s content.

If you plan to provide binary data, provide it pre-encoded to base64, and set content_is_b64=true.

Mutually exclusive with src. One of content and src is required.

content_is_b64

boolean

If set to true, the content in content is assumed to be Base64 encoded and will be decoded before being used.

To use binary content, it is better to keep it Base64 encoded and let it be decoded by this option. Otherwise you risk the data to be interpreted as UTF-8 and corrupted.

Choices:

  • false ← (default)

  • true

dest

string / required

Path to a file inside the Multipass virtual machine.

Must be an absolute path.

name

string / required

The name of the virtual machine to copy files to.

src

string

Path to a file on the managed node.

Mutually exclusive with content. One of content and src is required.

Examples

- name: Copy a file into the VM
  theko2fi.multipass.multipass_vm_transfer_into:
    name: foo
    src: /home/user/data.txt
    dest: /home/ubuntu/input.txt

- name: Copy a content into the VM
  theko2fi.multipass.multipass_vm_transfer_into:
    name: foo
    content: "Hello World!"
    dest: /home/ubuntu/input.txt

- name: Copy a file into the VM (ignore errors)
  theko2fi.multipass.multipass_vm_transfer_into:
    name: foo
    src: /home/user/data.txt
    dest: /input.txt
  ignore_errors: true

Authors

  • Kenneth KOFFI (@theko2fi)