damex.incus.incus_image_import module – Ensure Incus image from file or URL
Note
This module is part of the damex.incus collection (version 1.9.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 damex.incus.
To use it in a playbook, specify: damex.incus.incus_image_import.
Synopsis
Import and delete Incus images from local files or URLs.
Supports raw and qcow2 disk images for virtual machines.
Raw images are automatically converted to qcow2 using
qemu-img.ZIP archives are automatically extracted.
Images are project-scoped resources identified by alias.
Requires
qemu-imgon the target host for format detection and conversion.
Parameters
Parameter |
Comments |
|---|---|
Primary alias for the image on the local server. Used to check existence and as the first alias assigned on import. |
|
Additional aliases to assign to the image. |
|
Image architecture identifier. Default: |
|
Expected checksum of the source file for verification. Verified against the downloaded or local source file before any extraction or conversion. |
|
Hash algorithm used for Choices:
|
|
Client certificate content for remote authentication. Requires |
|
Path to the client certificate for remote authentication. Requires |
|
Client key content for remote authentication. Requires |
|
Path to the client key for remote authentication. Requires |
|
Delete and re-import the image even when the alias already exists. Useful when the upstream source has been updated at the same URL. Choices:
|
|
Incus project to query. Default: |
|
Image properties included in the metadata. |
|
Human-readable image description. |
|
Image name. |
|
Operating system name. |
|
Operating system release or version. |
|
Image serial or build identifier. |
|
Image variant. |
|
Make the image available to unauthenticated users. Choices:
|
|
Server certificate content for remote verification. Requires |
|
Path to the server certificate for remote verification. Requires |
|
Path to the Incus Unix socket for local connections. Default: |
|
Path to a local image file or URL to download from. Supports raw and qcow2 disk images. ZIP archives are automatically extracted. Required when |
|
Desired state of the image. Choices:
|
|
Timeout in seconds for downloading the source file from a URL. Only applies when Default: |
|
Token for remote authentication. Requires |
|
URL of the remote Incus server (e.g. https://host:8443). If specified, connects via HTTPS instead of Unix socket. |
|
Whether to validate the server TLS certificate. Choices:
|
|
Whether to wait for async operations to complete before returning. Set to Choices:
|
Examples
- name: Ensure MikroTik CHR image from URL
damex.incus.incus_image_import:
alias: chr/7.22
source: https://download.mikrotik.com/routeros/7.22/chr-7.22.img.zip
architecture: x86_64
properties:
os: RouterOS
release: "7.22"
description: MikroTik CHR 7.22
- name: Ensure MikroTik CHR image with checksum verification
damex.incus.incus_image_import:
alias: chr/7.22
source: https://download.mikrotik.com/routeros/7.22/chr-7.22.img.zip
checksum: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
checksum_algorithm: sha256
properties:
os: RouterOS
release: "7.22"
description: MikroTik CHR 7.22
- name: Ensure image from local qcow2 file
damex.incus.incus_image_import:
alias: custom/1.0
source: /tmp/custom-image.qcow2
properties:
os: CustomOS
release: "1.0"
description: Custom OS Image
- name: Ensure image with multiple aliases
damex.incus.incus_image_import:
alias: chr
aliases:
- chr/7.22
source: https://download.mikrotik.com/routeros/7.22/chr-7.22.img.zip
properties:
os: RouterOS
release: "7.22"
description: MikroTik CHR 7.22
- name: Ensure image is re-imported from upstream
damex.incus.incus_image_import:
alias: chr/7.22
source: https://download.mikrotik.com/routeros/7.22/chr-7.22.img.zip
force: true
properties:
os: RouterOS
release: "7.22"
description: MikroTik CHR 7.22
- name: Ensure image is absent
damex.incus.incus_image_import:
alias: chr/7.22
state: absent