Manage LXD containers.
New in version 2019.2.0.
René Jochum <rene@jochums.at>
new
python-pylxd
Linux
Ensure a LXD container is not present, destroying it if present
The name of the container to destroy
stop before destroying default: false
An URL to a remote Server, you also have to give cert and key if you provide remote_addr!
https://myserver.lan:8443 /var/lib/mysocket.sock
PEM Formatted SSL Zertifikate.
~/.config/lxc/client.crt
PEM Formatted SSL Key.
~/.config/lxc/client.key
Wherever to verify the cert, this is by default True but in the most cases you want to set it off as LXD normally uses self-signed certificates.
Ensure a LXD container is frozen, start and freeze it if start is true
The name of the container to freeze
start and freeze it
An URL to a remote Server, you also have to give cert and key if you provide remote_addr!
https://myserver.lan:8443 /var/lib/mysocket.sock
PEM Formatted SSL Zertifikate.
~/.config/lxc/client.crt
PEM Formatted SSL Key.
~/.config/lxc/client.key
Wherever to verify the cert, this is by default True but in the most cases you want to set it off as LXD normally uses self-signed certificates.
Ensure a container is migrated to another host
If the container is running, it either must be shut down first (use stop_and_start=True) or criu must be installed on the source and destination machines.
For this operation both certs need to be authenticated,
use lxd.authenticate <salt.states.lxd.authenticate
to authenticate your cert(s).
The container to migrate
An URL to the destination remote Server
https://myserver.lan:8443 /var/lib/mysocket.sock
PEM Formatted SSL Zertifikate.
~/.config/lxc/client.crt
PEM Formatted SSL Key.
~/.config/lxc/client.key
Wherever to verify the cert, this is by default True but in the most cases you want to set it off as LXD normally uses self-signed certificates.
An URL to the source remote Server
https://myserver.lan:8443 /var/lib/mysocket.sock
Stop before migrating and start after
PEM Formatted SSL Zertifikate, if None we copy "cert"
~/.config/lxc/client.crt
PEM Formatted SSL Key, if None we copy "key"
~/.config/lxc/client.key
Wherever to verify the cert, if None we copy "verify_cert"
Create the named container if it does not exist
The name of the container to be created
If True
, ensure that the container is running
If False
, ensure that the container is stopped
If None
, do nothing with regards to the running state of the
container
Can be either a string containing an image alias:
"xenial/amd64"
or an dict with type "image" with alias:
{"type": "image",
"alias": "xenial/amd64"}
or image with "fingerprint":
{"type": "image",
"fingerprint": "SHA-256"}
or image with "properties":
{"type": "image",
"properties": {
"os": "ubuntu",
"release": "14.04",
"architecture": "x86_64"
}}
or none:
{"type": "none"}
or copy:
{"type": "copy",
"source": "my-old-container"}
List of profiles to apply on this container
A config dict or None (None = unset).
Can also be a list:
[{'key': 'boot.autostart', 'value': 1},
{'key': 'security.privileged', 'value': '1'}]
A device dict or None (None = unset).
Can be one of the following:
unknown
i686
x86_64
armv7l
aarch64
ppc
ppc64
ppc64le
s390x
Destroy this container after stop?
Restart the container when we detect changes on the config or its devices?
An URL to a remote Server, you also have to give cert and key if you provide remote_addr!
https://myserver.lan:8443 /var/lib/mysocket.sock
PEM Formatted SSL Zertifikate.
~/.config/lxc/client.crt
PEM Formatted SSL Key.
~/.config/lxc/client.key
Wherever to verify the cert, this is by default True but in the most cases you want to set it off as LXD normally uses self-signed certificates.
Ensure a LXD container is running and restart it if restart is True
The name of the container to start/restart.
restart the container if it is already started.
An URL to a remote Server, you also have to give cert and key if you provide remote_addr!
https://myserver.lan:8443 /var/lib/mysocket.sock
PEM Formatted SSL Zertifikate.
~/.config/lxc/client.crt
PEM Formatted SSL Key.
~/.config/lxc/client.key
Wherever to verify the cert, this is by default True but in the most cases you want to set it off as LXD normally uses self-signed certificates.
Ensure a LXD container is stopped, kill it if kill is true else stop it
The name of the container to stop
kill if true
An URL to a remote Server, you also have to give cert and key if you provide remote_addr!
https://myserver.lan:8443 /var/lib/mysocket.sock
PEM Formatted SSL Zertifikate.
~/.config/lxc/client.crt
PEM Formatted SSL Key.
~/.config/lxc/client.key
Wherever to verify the cert, this is by default True but in the most cases you want to set it off as LXD normally uses self-signed certificates.