incus

States for managing Incus instances.

present(), running(), stopped() and absent() manage instance lifecycle; sls_applied() applies SLS inside an instance through the agentless thin path and surfaces the in-instance highstate result.

present() reconciles declared config and devices additively: it sets what you declare and leaves undeclared keys, devices and profile membership alone.

depends:

incus execution module

saltext.incus.states.incus.__virtual__()[source]

Only load when the incus execution module is available.

saltext.incus.states.incus.present(name, image=None, profiles=None, config=None, devices=None, running=None, project=None)[source]

Ensure an instance exists with the declared config and devices.

name

Instance name.

image

Source image. Required only when the instance must be created.

profiles

Profiles to attach at creation. Not reconciled after creation.

config

Instance config keys to ensure are set.

devices

Devices to ensure are present, mapping device name to a definition that includes a type.

running

True ensures the instance is running, False ensures it is stopped, None leaves the run state untouched.

Example:

web01:
  incus.present:
    - image: images:debian/12
    - running: true
    - config:
        boot.autostart: true
saltext.incus.states.incus.running(name, project=None)[source]

Ensure an existing instance is running.

Example:

web01 running:
  incus.running:
    - name: web01
saltext.incus.states.incus.stopped(name, timeout=30, force=False, project=None)[source]

Ensure an existing instance is stopped.

Example:

web01 stopped:
  incus.stopped:
    - name: web01
saltext.incus.states.incus.absent(name, force=True, project=None)[source]

Ensure an instance does not exist.

Example:

web01 absent:
  incus.absent:
    - name: web01
saltext.incus.states.incus.sls_applied(name, mods, pillar=None, saltenv='base', transport='thin', pillar_mode='file', precompiled=False, cleanup=True, project=None)[source]

Apply SLS mods inside a running instance via the agentless thin path.

The instance must already exist and be running (compose this after present() or running()). The in-instance highstate result is mapped onto this state’s result: any failed inner state fails this state, test=True yields a None result, and the inner changes are reported through changes.

name

Instance name.

mods

SLS modules to apply, as a list or comma-separated string.

pillar

Pillar to use, already resolved on the control node.

precompiledFalse

Compile on the control node and ship low state instead of SLS source. See incus.sls.

Example:

web01 configured:
  incus.sls_applied:
    - name: web01
    - mods:
      - access.users
      - access.sshd
    - pillar:
        access: {{ salt['pillar.get']('access') | json }}