neulab/tldr huggingface dataset:
dest   Destination on the container. Must be an absolute path.
Changed in version 2015.5.0: If the destination is a directory, the file will be copied into that directory.
makedirs : False Create the parent directory on the container if it does not already exist.
salt 'minion' lxc.copy_to /tmp/foo /root/foo salt 'minion' lxc.cp /tmp/foo /root/foo
salt.modules.lxc.cp(name, source, dest, overwrite=False, makedirs=False, path=None) This function is an alias of copy_to. Changed in version 2015.8.0: Function renamed from lxc.cp to lxc.copy_to for consistency with other container types. lxc.cp will continue to work, however.  For versions 2015.2.x and earlier, use lxc.cp.
salt.modules.lxc.create(name, config=None, profile=None, network_profile=None, nic_opts=None, **kwargs) Create a new container.
config The config file to use for the container. Defaults to system-wide config (usually in /etc/lxc/lxc.conf).
profile Profile to use in container creation (see lxc.get_container_profile). Values in a profile will be overridden by the Container Creation Arguments listed below.
Container Creation Arguments
template The template to use. For example, ubuntu or fedora.  For a full list of available templates, check out the lxc.templates function.
Conflicts with the image argument.
NOTE: The download template requires the following three parameters to be defined in options:
• dist - The name of the distribution
• release - Release name/version
• arch - Architecture of the container
The available images can be listed using the lxc.images function.
options Template-specific options to pass to the lxc-create command. These correspond to the long options (ones beginning with two dashes) that the template script accepts. For example:
options='{"dist": "centos", "release": "6", "arch": "amd64"}'
For available template options, refer to the lxc template scripts which are usually located under /usr/share/lxc/templates, or run lxc-create -t <template> -h.
image  A tar archive to use as the rootfs for the container. Conflicts with the template argument.
fstype Filesystem type to use on LVM logical volume
vgname lxc Name of the LVM volume group in which to create the volume for this container. Only applicable if backing=lvm.
lvname Name of the LVM logical volume in which to create the volume for this container. Only applicable if backing=lvm.
thinpool Name of a pool volume that will be used for thin-provisioning this container. Only applicable if backing=lvm.
path   parent path for the container creation (default: /var/lib/lxc)
zfsroot Name of the ZFS root in which to create the volume for this container.  Only applicable if backing=zfs. (default: tank/lxc)
salt.modules.lxc.destroy(name, stop=False, path=None) Destroy the named container.
WARNING: Destroys all data associated with the container.
stop   False If True, the container will be destroyed even if it is running/frozen.
Changed in version 2015.5.0: Default value changed to False. This more closely matches the behavior of lxc-destroy(1), and also makes it less likely that an accidental command will destroy a running container that was being used for important things.
salt '*' lxc.destroy foo salt '*' lxc.destroy foo stop=True
salt.modules.lxc.edit_conf(conf_file, out_format='simple', read_only=False, lxc_config=None, **kwargs) Edit an LXC configuration file. If a setting is already present inside the file, its value will be replaced. If it does not exist, it will be appended to the end of the file. Comments and blank lines will be kept in-tact if they already exist in the file.
out_format: Set to simple if you need backward compatibility (multiple items for a simple key is not supported)
read_only: return only the edited configuration without applying it to the underlying lxc configuration file
lxc_config: List of dict containning lxc configuration items For network configuration, you also need to add the device it belongs to, otherwise it will default to eth0.  Also, any change to a network parameter will result in the whole network reconfiguration to avoid mismatchs, be aware of that !
After the file is edited, its contents will be returned. By default, it will be returned in simple format, meaning an unordered dict (which may not represent the actual file order). Passing in an out_format of commented will return a data structure which accurately represents the order and content of the file.
salt 'minion' lxc.edit_conf /etc/lxc/mycontainer.conf \ out_format=commented lxc.network.type=veth salt 'minion' lxc.edit_conf /etc/lxc/mycontainer.conf \ out_format=commented \ lxc_config="[{'lxc.network.name': 'eth0', \ 'lxc.network.ipv4': '1.2.3.4'}, {'lxc.network.name': 'eth2', \ 'lxc.network.ipv4': '1.2.3.5',\ 'lxc.network.gateway': '1.2.3.1'}]"
salt.modules.lxc.exists(name, path=None) Returns whether the named container exists.
salt '*' lxc.exists name
salt.modules.lxc.freeze(name, **kwargs) Freeze the named container
start  False If True and the container is stopped, the container will be started before attempting to freeze.
use_vt run the command through VT
salt '*' lxc.freeze name
salt.modules.lxc.get_container_profile(name=None, **kwargs) New in version 2015.5.0.
Gather a pre-configured set of container configuration parameters. If no arguments are passed, an empty profile is returned.
Profiles can be defined in the minion or master config files, or in pillar or grains, and are loaded using config.get. The key under which LXC profiles must be configured is lxc.container_profile.profile_name. An example container profile would be as follows:
lxc.container_profile: ubuntu: template: ubuntu backing: lvm vgname: lxc size: 1G
Parameters set in a profile can be overridden by passing additional container creation arguments (such as the ones passed to lxc.create) to this function.
A profile can be defined either as the name of the profile, or a dictionary of variable names and values. See the LXC Tutorial for more information on how to use LXC profiles.
salt-call lxc.get_container_profile centos salt-call lxc.get_container_profile ubuntu template=ubuntu backing=overlayfs
salt.modules.lxc.get_network_profile(name=None, **kwargs) New in version 2015.5.0.
Gather a pre-configured set of network configuration parameters. If no arguments are passed, the following default profile is returned:
{'eth0': {'link': 'br0', 'type': 'veth', 'flags': 'up'}}
Profiles can be defined in the minion or master config files, or in pillar or grains, and are loaded using config.get. The key under which LXC profiles must be configured is lxc.network_profile. An example network profile would be as follows:
lxc.network_profile.centos: eth0: link: br0 type: veth flags: up
To disable networking entirely:
lxc.network_profile.centos: eth0: disable: true
Parameters set in a profile can be overridden by passing additional arguments to this function.
A profile can be passed either as the name of the profile, or a dictionary of variable names and values. See the LXC Tutorial for more information on how to use network profiles.
WARNING: The ipv4, ipv6, gateway, and link (bridge) settings in network profiles will only work if the container doesn't redefine the network configuration (for example in /etc/sysconfig/network-scripts/ifcfg-<interface_name> on RHEL/CentOS, or /etc/network/interfaces on Debian/Ubuntu/etc.)
salt-call lxc.get_network_profile default
salt.modules.lxc.get_parameter(name, parameter, path=None) Returns the value of a cgroup parameter for a container
salt '*' lxc.get_parameter container_name memory.limit_in_bytes
salt.modules.lxc.get_pid(name, path=None) Returns a container pid.  Throw an exception if the container isn't running.
salt '*' lxc.get_pid name
salt.modules.lxc.get_root_path(path) Get the configured lxc root for containers
salt '*' lxc.get_root_path
salt.modules.lxc.images(dist=None) New in version 2015.5.0.
List the available images for LXC's download template.
dist   None Filter results to a single Linux distribution
salt myminion lxc.images salt myminion lxc.images dist=centos
salt.modules.lxc.info(name, path=None) Returns information about a container
salt '*' lxc.info name
salt.modules.lxc.init(name, config=None, cpuset=None, cpushare=None, memory=None, profile=None, network_profile=None, nic_opts=None, cpu=None, autostart=True, password=None, password_encrypted=None, users=None, dnsservers=None, searchdomains=None, bridge=None, gateway=None, pub_key=None, priv_key=None, force_install=False, unconditional_install=False, bootstrap_delay=None, bootstrap_args=None, bootstrap_shell=None, bootstrap_url=None, **kwargs) Initialize a new container.
This is a partial idempotent function as if it is already provisioned, we will reset a bit the lxc configuration file but much of the hard work will be escaped as markers will prevent re-execution of harmful tasks.
cpus   Select a random number of cpu cores and assign it to the cpuset, if the cpuset option is set then this option will be ignored
cpuset Explicitly define the cpus this container will be bound to
cpushare cgroups cpu shares
autostart autostart container on reboot
memory cgroups memory limit, in MB
Changed in version 2015.5.0: If no value is passed, no limit is set. In earlier Salt versions, not passing this value causes a 1024MB memory limit to be set, and it was necessary to pass memory=0 to set no limit.
gateway the ipv4 gateway to use the default does nothing more than lxcutils does
bridge the bridge to use the default does nothing more than lxcutils does
network_profile Network profile to use for the container
nic_opts Extra options for network interfaces, will override
{"eth0": {"hwaddr": "aa:bb:cc:dd:ee:ff", "ipv4": "10.1.1.1", "ipv6": "2001:db8::ff00:42:8329"}}
{"eth0": {"hwaddr": "aa:bb:cc:dd:ee:ff", "ipv4": "10.1.1.1/24", "ipv6": "2001:db8::ff00:42:8329"}}
users  Users for which the password defined in the password param should be set. Can be passed as a comma separated list or a python list.  Defaults to just the root user.
password Set the initial password for the users defined in the users parameter
password_encrypted False Set to True to denote a password hash instead of a plaintext password
profile A LXC profile (defined in config or pillar).  This can be either a real profile mapping or a string to retrieve it in configuration
start  Start the newly-created container
dnsservers list of dns servers to set in the container, default [] (no setting)
seed   Seed the container with the minion config. Default: True
install If salt-minion is not already installed, install it. Default: True
config Optional config parameters. By default, the id is set to the name of the container.
master salt master (default to minion's master)
master_port salt master port (default to minion's master port)
pub_key Explicit public key to preseed the minion with (optional). This can be either a filepath or a string representing the key
priv_key Explicit private key to preseed the minion with (optional). This can be either a filepath or a string representing the key
approve_key If explicit preseeding is not used; Attempt to request key approval from the master. Default: True
clone_from Original from which to use a clone operation to create the container.  Default: None
bootstrap_url See lxc.bootstrap
bootstrap_shell See lxc.bootstrap
bootstrap_args See lxc.bootstrap
salt 'minion' lxc.init name [cpuset=cgroups_cpuset] \ [cpushare=cgroups_cpushare] [memory=cgroups_memory] \ [nic=nic_profile] [profile=lxc_profile] \ [nic_opts=nic_opts] [start=(True|False)] \ [seed=(True|False)] [install=(True|False)] \ [config=minion_config] [approve_key=(True|False) \ [clone_from=original] [autostart=True] \ [priv_key=/path_or_content] [pub_key=/path_or_content] \ [bridge=lxcbr0] [gateway=10.0.3.1] \ [dnsservers[dns1,dns2]] \ [users=[foo]] [password='secret'] \ [password_encrypted=(True|False)]
salt.modules.lxc.list_(extra=False, limit=None, path=None) List containers classified by state
extra  Also get per-container specific info. This will change the return data.  Instead of returning a list of containers, a dictionary of containers and each container's output from lxc.info.
limit  Return output matching a specific state (frozen, running, or stopped).
salt '*' lxc.list salt '*' lxc.list extra=True salt '*' lxc.list limit=running
salt.modules.lxc.ls_(active=None, cache=True, path=None) Return a list of the containers available on the minion
active If True, return only active (i.e. running) containers
salt '*' lxc.ls salt '*' lxc.ls active=True
salt.modules.lxc.read_conf(conf_file, out_format='simple') Read in an LXC configuration file. By default returns a simple, unsorted dict, but can also return a more detailed structure including blank lines and comments.
out_format: set to 'simple' if you need the old and unsupported behavior.  This won't support the multiple lxc values (eg: multiple network nics)
salt 'minion' lxc.read_conf /etc/lxc/mycontainer.conf salt 'minion' lxc.read_conf /etc/lxc/mycontainer.conf out_format=commented
salt.modules.lxc.reboot(name, path=None) Reboot a container.
salt 'minion' lxc.reboot myvm
salt.modules.lxc.reconfigure(name, cpu=None, cpuset=None, cpushare=None, memory=None, profile=None, network_profile=None, nic_opts=None, bridge=None, gateway=None, autostart=None, utsname=None, rootfs=None, path=None, **kwargs) Reconfigure a container.
This only applies to a few property
name   Name of the container.
utsname utsname of the container.
rootfs rootfs of the container.
cpu    Select a random number of cpu cores and assign it to the cpuset, if the cpuset option is set then this option will be ignored
cpushare cgroups cpu shares.
memory cgroups memory limit, in MB.  (0 for nolimit, None for old default 1024MB)
nic    Network interfaces profile (defined in config or pillar).
{"eth0": {"mac": "aa:bb:cc:dd:ee:ff", "ipv4": "10.1.1.1", "ipv6": "2001:db8::ff00:42:8329"}}
{"eth0": {"mac": "aa:bb:cc:dd:ee:ff", "ipv4": "10.1.1.1/24", "ipv6": "2001:db8::ff00:42:8329"}}
salt-call -lall mc_lxc_fork.reconfigure foobar nic_opts="{'eth1': {'mac': '00:16:3e:dd:ee:44'}}" memory=4
salt.modules.lxc.remove(name, stop=False, path=None) This function is an alias of destroy. Destroy the named container.
salt.modules.lxc.restart(name, path=None, lxc_config=None, force=False) New in version 2015.5.0.
Restart the named container. If the container was not running, the container will merely be started.
name   The name of the container
lxc_config path to a lxc config file config file will be guessed from container name otherwise
force  False If True, the container will be force-stopped instead of gracefully shut down
salt myminion lxc.restart name
salt.modules.lxc.retcode(name, cmd, no_start=False, preserve_state=True, stdin=None, python_shell=True, output_loglevel='debug', use_vt=False, path=None, ignore_retcode=False, chroot_fallback=False, keep_env='http_proxy,https_proxy,no_proxy') New in version 2015.5.0.
Run cmd.retcode within a container
WARNING: Many shell builtins do not work, failing with stderr similar to the following:
lxc_container: No such file or directory - failed to exec 'command'
The same error will be displayed in stderr if the command being run does not exist. If the retcode is nonzero and not what was expected, try using lxc.run_stderr or lxc.run_all.
name   Name of the container in which to run the command
no_start False If the container is not running, don't start it
preserve_state True After running the command, return the container to its previous state
use_vt False Use SaltStack's utils.vt to stream output to console output=all.
keep_env http_proxy,https_proxy,no_proxy A list of env vars to preserve. May be passed as commma-delimited list.
chroot_fallback if the container is not running, try to run the command using chroot default: false
salt myminion lxc.retcode mycontainer 'ip addr show'
salt.modules.lxc.run(name, cmd, no_start=False, preserve_state=True, stdin=None, python_shell=True, output_loglevel='debug', use_vt=False, path=None, ignore_retcode=False, chroot_fallback=False, keep_env='http_proxy,https_proxy,no_proxy') New in version 2015.8.0.
Run cmd.run within a container
The same error will be displayed in stderr if the command being run does not exist. If no output is returned using this function, try using lxc.run_stderr or lxc.run_all.
use_vt False Use SaltStack's utils.vt to stream output to console. Assumes output=all.
salt myminion lxc.run mycontainer 'ifconfig -a'
salt.modules.lxc.run_all(name, cmd, no_start=False, preserve_state=True, stdin=None, python_shell=True, output_loglevel='debug', use_vt=False, path=None, ignore_retcode=False, chroot_fallback=False, keep_env='http_proxy,https_proxy,no_proxy') New in version 2015.5.0.
Run cmd.run_all within a container
The same error will be displayed in stderr if the command being run does not exist.
salt myminion lxc.run_all mycontainer 'ip addr show'
salt.modules.lxc.run_stderr(name, cmd, no_start=False, preserve_state=True, stdin=None, python_shell=True, output_loglevel='debug', use_vt=False, path=None, ignore_retcode=False, chroot_fallback=False, keep_env='http_proxy,https_proxy,no_proxy') New in version 2015.5.0.
Run cmd.run_stderr within a container
The same error will be displayed if the command being run does not exist.
salt myminion lxc.run_stderr mycontainer 'ip addr show'
salt.modules.lxc.run_stdout(name, cmd, no_start=False, preserve_state=True, stdin=None, python_shell=True, output_loglevel='debug', use_vt=False, path=None, ignore_retcode=False, chroot_fallback=False, keep_env='http_proxy,https_proxy,no_proxy') New in version 2015.5.0.
Run cmd.run_stdout within a container
salt myminion lxc.run_stdout mycontainer 'ifconfig -a'
salt.modules.lxc.running_systemd(name, cache=True, path=None) Determine if systemD is running
salt '*' lxc.running_systemd ubuntu
salt.modules.lxc.search_lxc_bridge() Search the first bridge which is potentially available as LXC bridge
salt '*' lxc.search_lxc_bridge
salt.modules.lxc.search_lxc_bridges() Search which bridges are potentially available as LXC bridges
salt '*' lxc.search_lxc_bridges
salt.modules.lxc.set_dns(name, dnsservers=None, searchdomains=None, path=None) Changed in version 2015.5.0: The dnsservers and searchdomains parameters can now be passed as a comma-separated list.
Update /etc/resolv.confo
path path to the container parent default: /var/lib/lxc (system default)
salt myminion lxc.set_dns ubuntu "['8.8.8.8', '4.4.4.4']"
salt.modules.lxc.set_parameter(name, parameter, value, path=None) Set the value of a cgroup parameter for a container.
salt '*' lxc.set_parameter name parameter value
salt.modules.lxc.set_pass(name, users, password, encrypted=True, path=None) This function is an alias of set_password. Changed in version 2015.5.0: Function renamed from set_pass to set_password. Additionally, this function now supports (and defaults to using) a password hash instead of a plaintext password.
Set the password of one or more system users inside containers
users  Comma-separated list (or python list) of users to change password
password Password to set for the specified user(s)
encrypted True If true, password must be a password hash. Set to False to set a plaintext password (not recommended).
salt '*' lxc.set_pass container-name root '$6$uJ2uAyLU$KoI67t8As/0fXtJOPcHKGXmUpcoYUcVR2K6x93walnShTCQvjRwq25yIkiCBOqgbfdKQSFnAo28/ek6716vEV1' salt '*' lxc.set_pass container-name root foo encrypted=False
salt.modules.lxc.set_password(name, users, password, encrypted=True, path=None) Changed in version 2015.5.0: Function renamed from set_pass to set_password. Additionally, this function now supports (and defaults to using) a password hash instead of a plaintext password.
salt.modules.lxc.start(name, **kwargs) Start the named container
salt myminion lxc.start name
salt.modules.lxc.state(name, path=None) Returns the state of a container.
salt '*' lxc.state name
salt.modules.lxc.stop(name, kill=False, path=None, use_vt=None) Stop the named container
kill: False Do not wait for the container to stop, kill all tasks in the container.  Older LXC versions will stop containers like this irrespective of this argument.
Changed in version 2015.5.0: Default value changed to False
salt myminion lxc.stop name
salt.modules.lxc.systemd_running_state(name, path=None) Get the operational state of a systemd based container
salt myminion lxc.systemd_running_state ubuntu
salt.modules.lxc.templates() New in version 2015.5.0.
List the available LXC template scripts installed on the minion
salt myminion lxc.templates
salt.modules.lxc.test_bare_started_state(name, path=None) Test if a non systemd container is fully started For now, it consists only to test if the container is attachable
salt myminion lxc.test_bare_started_state ubuntu
salt.modules.lxc.test_sd_started_state(name, path=None) Test if a systemd container is fully started
salt myminion lxc.test_sd_started_state ubuntu
salt.modules.lxc.unfreeze(name, path=None, use_vt=None) Unfreeze the named container.
salt '*' lxc.unfreeze name
salt.modules.lxc.update_lxc_conf(name, lxc_conf, lxc_conf_unset, path=None) Edit LXC configuration options
salt myminion lxc.update_lxc_conf ubuntu \ lxc_conf="[{'network.ipv4.ip':'10.0.3.5'}]" \ lxc_conf_unset="['lxc.utsname']"
salt.modules.lxc.version() Return the actual lxc client version
salt '*' lxc.version
salt.modules.lxc.wait_started(name, path=None, timeout=300) Check that the system has fully inited
This is actually very important for systemD based containers
see https://github.com/saltstack/salt/issues/23847
salt myminion lxc.wait_started ubuntu
salt.modules.lxc.write_conf(conf_file, conf) Write out an LXC configuration file
This is normally only used internally. The format of the data structure must match that which is returned from lxc.read_conf(), with out_format set to commented.
An example might look like:
[ {'lxc.utsname': '$CONTAINER_NAME'}, '# This is a commented line\n', '\n', {'lxc.mount': '$CONTAINER_FSTAB'}, {'lxc.rootfs': {'comment': 'This is another test', 'value': 'This is another test'}}, '\n', {'lxc.network.type': 'veth'}, {'lxc.network.flags': 'up'}, {'lxc.network.link': 'br0'}, {'lxc.network.mac': '$CONTAINER_MACADDR'}, {'lxc.network.ipv4': '$CONTAINER_IPADDR'}, {'lxc.network.name': '$CONTAINER_DEVICENAME'}, ]
salt 'minion' lxc.write_conf /etc/lxc/mycontainer.conf \ out_format=commented
salt.modules.lxd Module for managing the LXD daemon and its containers.
LXD(1) is a container "hypervisor". This execution module provides several functions to help manage it and its containers.
• pylxd(2) version >=2.2.5 is required to let this work, currently only available via pip. To install on Ubuntu:
$ apt-get install libssl-dev python-pip $ pip install -U pylxd
• you need lxd installed on the minion for the init() and version() methods.
• for the config_get() and config_get() methods you need to have lxd-client installed.
maintainer René Jochum <rene@jochums.at>
depends python-pylxd
salt.modules.lxd.authenticate(remote_addr, password, cert, key, verify_cert=True) Authenticate with a remote LXDaemon.
remote_addr : An URL to a remote Server, you also have to give cert and key if you provide remote_addr and its a TCP Address!
Examples: https://myserver.lan:8443
password : The password of the remote.
cert : PEM Formatted SSL Certificate.
Examples: ~/.config/lxc/client.crt
key :  PEM Formatted SSL Key.
Examples: ~/.config/lxc/client.key
verify_cert True 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.
salt '*' lxd.authenticate https://srv01:8443 <yourpass> ~/.config/lxc/client.crt ~/.config/lxc/client.key false
See the requests-docs for the SSL stuff.
salt.modules.lxd.config_get(key) Get an LXD daemon config option
key :  The key of the config value to retrieve
salt '*' lxd.config_get core.https_address
salt.modules.lxd.config_set(key, value) Set an LXD daemon config option
To listen on IPv4 and IPv6 port 8443, you can omit the :8443 its the default:
salt '*' lxd.config_set core.https_address [::]:8443
To set the server trust password:
salt '*' lxd.config_set core.trust_password blah
salt.modules.lxd.container_config_delete(name, config_key, remote_addr=None, cert=None, key=None, verify_cert=True) Delete a container config value
name : Name of the container
config_key : The config key to delete
Examples: https://myserver.lan:8443 /var/lib/mysocket.sock
salt.modules.lxd.container_config_get(name, config_key, remote_addr=None, cert=None, key=None, verify_cert=True) Get a container config value
config_key : The config key to retrieve
salt.modules.lxd.container_config_set(name, config_key, config_value, remote_addr=None, cert=None, key=None, verify_cert=True) Set a container config value
config_key : The config key to set
config_value : The config value to set
salt.modules.lxd.container_create(name, source, profiles=None, config=None, devices=None, architecture='x86_64', ephemeral=False, wait=True, remote_addr=None, cert=None, key=None, verify_cert=True, _raw=False) Create a container
name : The name of the container
source :
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"}
profiles ['default'] List of profiles to apply on this container
config : A config dict or None (None = unset).
Can also be a list:
[{'key': 'boot.autostart', 'value': 1}, {'key': 'security.privileged', 'value': '1'}]
devices : A device dict or None (None = unset).
architecture 'x86_64'.INDENT 7.0
Can be one of the following:
• unknown
• i686
• x86_64
• armv7l
• aarch64
• ppc
• ppc64
• ppc64le
• s390x
ephemeral False Destroy this container after stop?
_raw   False Return the raw pyxld object or a dict?
salt '*' lxd.container_create test xenial/amd64
See also the rest-api-docs.
salt.modules.lxd.container_delete(name, remote_addr=None, cert=None, key=None, verify_cert=True) Delete a container
name : Name of the container to delete
salt.modules.lxd.container_device_add(name, device_name, device_type='disk', remote_addr=None, cert=None, key=None, verify_cert=True, **kwargs) Add a container device
device_name : The device name to add
device_type : Type of the device
** kwargs : Additional device args
salt.modules.lxd.container_device_delete(name, device_name, remote_addr=None, cert=None, key=None, verify_cert=True) Delete a container device
device_name : The device name to delete
salt.modules.lxd.container_device_get(name, device_name, remote_addr=None, cert=None, key=None, verify_cert=True) Get a container device
device_name : The device name to retrieve
salt.modules.lxd.container_execute(name, cmd, remote_addr=None, cert=None, key=None, verify_cert=True) Execute a command list on a container.
cmd :  Command to be executed (as a list)
Example : '["ls", "-l"]'
salt '*' lxd.container_execute <container name> '["ls", "-l"]'
salt.modules.lxd.container_file_get(name, src, dst, overwrite=False, mode=None, uid=None, gid=None, remote_addr=None, cert=None, key=None, verify_cert=True) Get a file from a container
src :  The source file or directory
dst :  The destination file or directory
mode : Set file mode to octal number
uid :  Set file uid (owner)
gid :  Set file gid (group)
salt.modules.lxd.container_file_put(name, src, dst, recursive=False, overwrite=False, mode=None, uid=None, gid=None, saltenv='base', remote_addr=None, cert=None, key=None, verify_cert=True) Put a file into a container
recursive : Decent into src directory
overwrite : Replace destination if it exists
salt '*' lxd.container_file_put <container name> /var/tmp/foo /var/tmp/
salt.modules.lxd.container_freeze(name, remote_addr=None, cert=None, key=None, verify_cert=True) Freeze a container
name : Name of the container to freeze
salt.modules.lxd.container_get(name=None, remote_addr=None, cert=None, key=None, verify_cert=True, _raw=False) Gets a container from the LXD
name : The name of the container to get.
_raw : Return the pylxd object, this is internal and by states in use.
salt.modules.lxd.container_list(list_names=False, remote_addr=None, cert=None, key=None, verify_cert=True) Lists containers
list_names False Only return a list of names when True
Full dict with all available information:
salt '*' lxd.container_list
For a list of names:
salt '*' lxd.container_list true
See also container-attributes.
salt.modules.lxd.container_migrate(name, stop_and_start=False, remote_addr=None, cert=None, key=None, verify_cert=True, src_remote_addr=None, src_cert=None, src_key=None, src_verify_cert=None) Migrate a container.
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.modules.lxd.authenticate to authenticate your cert(s).
name : Name of the container to migrate
stop_and_start : Stop the container on the source and start it on dest
# Authorize salt '*' lxd.authenticate https://srv01:8443 <yourpass> ~/.config/lxc/client.crt ~/.config/lxc/client.key false salt '*' lxd.authenticate https://srv02:8443 <yourpass> ~/.config/lxc/client.crt ~/.config/lxc/client.key false
# Migrate phpmyadmin from srv01 to srv02 salt '*' lxd.container_migrate phpmyadmin stop_and_start=true remote_addr=https://srv02:8443 cert=~/.config/lxc/client.crt key=~/.config/lxc/client.key verify_cert=False src_remote_addr=https://srv01:8443
salt.modules.lxd.container_rename(name, newname, remote_addr=None, cert=None, key=None, verify_cert=True) Rename a container
name : Name of the container to Rename
newname : The new name of the container
salt.modules.lxd.container_restart(name, remote_addr=None, cert=None, key=None, verify_cert=True) Restart a container
name : Name of the container to restart
salt.modules.lxd.container_start(name, remote_addr=None, cert=None, key=None, verify_cert=True) Start a container
name : Name of the container to start
salt.modules.lxd.container_state(name=None, remote_addr=None, cert=None, key=None, verify_cert=True) Get container state
salt.modules.lxd.container_stop(name, timeout=30, force=True, remote_addr=None, cert=None, key=None, verify_cert=True) Stop a container
name : Name of the container to stop
salt.modules.lxd.container_unfreeze(name, remote_addr=None, cert=None, key=None, verify_cert=True) Unfreeze a container
name : Name of the container to unfreeze
salt.modules.lxd.image_alias_add(image, alias, description='', remote_addr=None, cert=None, key=None, verify_cert=True) Create an alias on the given image
image : An image alias, a fingerprint or a image object
alias : The alias to add
description : Description of the alias
salt '*' lxd.image_alias_add xenial/amd64 x "Short version of xenial/amd64"
salt.modules.lxd.image_alias_delete(image, alias, remote_addr=None, cert=None, key=None, verify_cert=True) Delete an alias (this is currently not restricted to the image)
alias : The alias to delete
salt.modules.lxd.image_copy_lxd(source, src_remote_addr, src_cert, src_key, src_verify_cert, remote_addr, cert, key, verify_cert=True, aliases=None, public=None, auto_update=None, _raw=False) Copy an image from another LXD instance
source : An alias or a fingerprint of the source.
src_remote_addr : An URL to the source remote daemon
Examples: https://mysourceserver.lan:8443
src_cert : PEM Formatted SSL Certificate for the source
src_key : PEM Formatted SSL Key for the source
src_verify_cert True 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.
remote_addr : Address of the destination daemon
Examples: https://mydestserver.lan:8443
cert : PEM Formatted SSL Certificate for the destination
key :  PEM Formatted SSL Key for the destination
aliases [] List of aliases to append to the copied image
public None Make this image public available, None = copy source
auto_update None Wherever to auto-update from the original source, None = copy source
_raw   False Return the raw pylxd object or a dict of the destination image?
salt '*' lxd.image_copy_lxd xenial/amd64 https://srv01:8443 ~/.config/lxc/client.crt ~/.config/lxc/client.key false https://srv02:8443 ~/.config/lxc/client.crt ~/.config/lxc/client.key false aliases="['xenial/amd64']"
salt.modules.lxd.image_delete(image, remote_addr=None, cert=None, key=None, verify_cert=True) Delete an image by an alias or fingerprint
name : The alias or fingerprint of the image to delete, can be a obj for the states.
salt '*' lxd.image_delete xenial/amd64
salt.modules.lxd.image_from_file(filename, remote_addr=None, cert=None, key=None, verify_cert=True, aliases=None, public=False, saltenv='base', _raw=False) Create an image from a file
filename : The filename of the rootfs
public False Make this image public available
saltenv base The saltenv to use for salt:// copies
_raw   False Return the raw pylxd object or a dict of the image?
salt '*' lxd.image_from_file salt://lxd/files/busybox.tar.xz aliases=["busybox-amd64"]
salt.modules.lxd.image_from_simplestreams(server, alias, remote_addr=None, cert=None, key=None, verify_cert=True, aliases=None, public=False, auto_update=False, _raw=False) Create an image from simplestreams
server : Simplestreams server URI
alias : The alias of the image to retrieve
auto_update False Should LXD auto update that image?
salt '*' lxd.image_from_simplestreams "https://cloud-images.ubuntu.com/releases" "trusty/amd64" aliases='["t", "trusty/amd64"]' auto_update=True
salt.modules.lxd.image_from_url(url, remote_addr=None, cert=None, key=None, verify_cert=True, aliases=None, public=False, auto_update=False, _raw=False) Create an image from an url
url :  The URL from where to download the image
salt '*' lxd.image_from_url https://dl.stgraber.org/lxd aliases='["busybox-amd64"]'
salt.modules.lxd.image_get(fingerprint, remote_addr=None, cert=None, key=None, verify_cert=True, _raw=False) Get an image by its fingerprint
fingerprint : The fingerprint of the image to retrieve
_raw   False Return the raw pylxd object or a dict of it?
salt '*' lxd.image_get <fingerprint>
salt.modules.lxd.image_get_by_alias(alias, remote_addr=None, cert=None, key=None, verify_cert=True, _raw=False) Get an image by an alias
salt '*' lxd.image_get_by_alias xenial/amd64
salt.modules.lxd.image_list(list_aliases=False, remote_addr=None, cert=None, key=None, verify_cert=True) Lists all images from the LXD.
list_aliases : Return a dict with the fingerprint as key and a list of aliases as value instead.
salt '*' lxd.image_list true --out=json salt '*' lxd.image_list --out=json
salt.modules.lxd.init(storage_backend='dir', trust_password=None, network_address=None, network_port=None, storage_create_device=None, storage_create_loop=None, storage_pool=None) Calls lxd init --auto -- opts
storage_backend : Storage backend to use (zfs or dir, default: dir)
trust_password : Password required to add new clients
network_address None Address to bind LXD to (default: none)
network_port None Port to bind LXD to (Default: 8443)
storage_create_device None Setup device based storage using this DEVICE
storage_create_loop None Setup loop based storage with this SIZE in GB
storage_pool None Storage pool to use or create
To listen on all IPv4/IPv6 Addresses:
salt '*' lxd.init dir PaSsW0rD [::]
To not listen on Network:
salt '*' lxd.init
salt.modules.lxd.normalize_input_values(config, devices) normalize config input so returns can be put into mongodb, which doesn't like .
This is not meant to be used on the commandline.
salt '*' lxd.normalize_input_values config={} devices={}
salt.modules.lxd.profile_config_delete(name, config_key, remote_addr=None, cert=None, key=None, verify_cert=True) Delete a profile config item.
name : The name of the profile to delete the config item.
config_key : The config key for the value to retrieve.
salt '*' lxd.profile_config_delete autostart boot.autostart.delay
salt.modules.lxd.profile_config_get(name, config_key, remote_addr=None, cert=None, key=None, verify_cert=True) Get a profile config item.
name : The name of the profile to get the config item from.
config_key : The key for the item to retrieve.
salt '*' lxd.profile_config_get autostart boot.autostart
salt.modules.lxd.profile_config_set(name, config_key, config_value, remote_addr=None, cert=None, key=None, verify_cert=True) Set a profile config item.
name : The name of the profile to set the config item to.
config_key : The items key.
config_value : Its items value.
salt '*' lxd.profile_config_set autostart boot.autostart 0
salt.modules.lxd.profile_create(name, config=None, devices=None, description=None, remote_addr=None, cert=None, key=None, verify_cert=True) Creates a profile.
name : The name of the profile to get.
description : A description string or None (None = unset).
salt '*' lxd.profile_create autostart config="{boot.autostart: 1, boot.autostart.delay: 2, boot.autostart.priority: 1}" salt '*' lxd.profile_create shared_mounts devices="{shared_mount: {type: 'disk', source: '/home/shared', path: '/home/shared'}}"
See the lxd-docs for the details about the config and devices dicts.
salt.modules.lxd.profile_delete(name, remote_addr=None, cert=None, key=None, verify_cert=True) Deletes a profile.
name : The name of the profile to delete.
salt '*' lxd.profile_delete shared_mounts
salt.modules.lxd.profile_device_delete(name, device_name, remote_addr=None, cert=None, key=None, verify_cert=True) Delete a profile device.
name : The name of the profile to delete the device.
device_name : The name of the device to delete.
salt '*' lxd.profile_device_delete autostart eth1
salt.modules.lxd.profile_device_get(name, device_name, remote_addr=None, cert=None, key=None, verify_cert=True) Get a profile device.
name : The name of the profile to get the device from.
device_name : The name of the device to retrieve.
salt '*' lxd.profile_device_get default eth0
salt.modules.lxd.profile_device_set(name, device_name, device_type='disk', remote_addr=None, cert=None, key=None, verify_cert=True, **kwargs) Set a profile device.
name : The name of the profile to set the device to.
device_name : The name of the device to set.
salt '*' lxd.profile_device_set autostart eth1 nic nictype=bridged parent=lxdbr0
salt.modules.lxd.profile_get(name, remote_addr=None, cert=None, key=None, verify_cert=True, _raw=False) Gets a profile from the LXD
salt '*' lxd.profile_get autostart
salt.modules.lxd.profile_list(list_names=False, remote_addr=None, cert=None, key=None, verify_cert=True) Lists all profiles from the LXD.
list_names : Return a list of names instead of full blown dicts.
salt '*' lxd.profile_list true --out=json salt '*' lxd.profile_list --out=json
salt.modules.lxd.pylxd_client_get(remote_addr=None, cert=None, key=None, verify_cert=True) Get an pyxld client, this is not meant to be run over the CLI.
salt.modules.lxd.pylxd_save_object(obj)
Saves an object (profile/image/container) and translate its execpetion on failure
obj :  The object to save
This is an internal method, no CLI Example.
salt.modules.lxd.pylxd_version() Returns the actual pylxd version.
salt '*' lxd.pylxd_version
salt.modules.lxd.snapshots_all(container, remote_addr=None, cert=None, key=None, verify_cert=True) Get all snapshots for a container
container : The name of the container to get.
remote_addr : An URL to a remote server. The 'cert' and 'key' fields must also be provided if 'remote_addr' is defined.
verify_cert True Verify the ssl certificate.  Default: True
salt '*' lxd.snapshots_all test-container
salt.modules.lxd.snapshots_create(container, name=None, remote_addr=None, cert=None, key=None, verify_cert=True) Create a snapshot for a container
name : The name of the snapshot.
salt '*' lxd.snapshots_create test-container test-snapshot
salt.modules.lxd.snapshots_delete(container, name, remote_addr=None, cert=None, key=None, verify_cert=True) Delete a snapshot for a container
salt '*' lxd.snapshots_delete test-container test-snapshot
salt.modules.lxd.snapshots_get(container, name, remote_addr=None, cert=None, key=None, verify_cert=True) Get information about snapshot for a container
salt '*' lxd.snapshots_get test-container test-snapshot
salt.modules.lxd.sync_config_devices(obj, newconfig, newdevices, test=False) Syncs the given config and devices with the object (a profile or a container) returns a changes dict with all changes made.
obj :  The object to sync with / or just test with.
newconfig: The new config to check with the obj.
newdevices: The new devices to check with the obj.
test:  Wherever to not change anything and give "Would change" message.
salt.modules.lxd.version() Returns the actual lxd version.
salt '*' lxd.version
salt.modules.mac_assistive This module allows you to manage assistive access on macOS minions with 10.9+
salt '*' assistive.install /usr/bin/osascript
salt.modules.mac_assistive.enable(app_id, enabled=True) Enable or disable an existing assistive access application.
app_id The bundle ID or command to set assistive access status.
enabled Sets enabled or disabled status. Default is True.
salt '*' assistive.enable /usr/bin/osascript salt '*' assistive.enable com.smileonmymac.textexpander enabled=False
salt.modules.mac_assistive.enabled(app_id) Check if a bundle ID or command is listed in assistive access and enabled.
app_id The bundle ID or command to retrieve assistive access status.
salt '*' assistive.enabled /usr/bin/osascript salt '*' assistive.enabled com.smileonmymac.textexpander
salt.modules.mac_assistive.install(app_id, enable=True) Install a bundle ID or command as being allowed to use assistive access.
app_id The bundle ID or command to install for assistive access.
salt '*' assistive.install /usr/bin/osascript salt '*' assistive.install com.smileonmymac.textexpander
salt.modules.mac_assistive.installed(app_id) Check if a bundle ID or command is listed in assistive access. This will not check to see if it's enabled.
app_id The bundle ID or command to check installed status.
salt '*' assistive.installed /usr/bin/osascript salt '*' assistive.installed com.smileonmymac.textexpander
salt.modules.mac_assistive.remove(app_id) Remove a bundle ID or command as being allowed to use assistive access.
app_id The bundle ID or command to remove from assistive access list.
salt '*' assistive.remove /usr/bin/osascript salt '*' assistive.remove com.smileonmymac.textexpander
salt.modules.mac_brew_pkg Homebrew for macOS
salt.modules.mac_brew_pkg.available_version(*names, **kwargs) This function is an alias of latest_version. Return the latest version of the named package available for upgrade or installation
Currently chooses stable versions, falling back to devel if that does not exist.
salt '*' pkg.latest_version <package name> salt '*' pkg.latest_version <package1> <package2> <package3>
salt.modules.mac_brew_pkg.hold(name=None, pkgs=None, sources=None, **kwargs) Set package in 'hold' state, meaning it will not be upgraded.
salt.modules.mac_brew_pkg.info_installed(*names, **kwargs) Return the information of the named package(s) installed on the system.
salt '*' pkg.info_installed <package1> salt '*' pkg.info_installed <package1> <package2> <package3> ...
salt.modules.mac_brew_pkg.install(name=None, pkgs=None, taps=None, options=None, **kwargs) Install the passed package(s) with brew install
name   The name of the formula to be installed. Note that this parameter is ignored if "pkgs" is passed.
taps   Unofficial GitHub repos to use when updating and installing formulas.
salt '*' pkg.install <package name> tap='<tap>' salt '*' pkg.install zlib taps='homebrew/dupes' salt '*' pkg.install php54 taps='["josegonzalez/php", "homebrew/dupes"]'
options Options to pass to brew. Only applies to initial install. Due to how brew works, modifying chosen options requires a full uninstall followed by a fresh install. Note that if "pkgs" is used, all options will be passed to all packages. Unrecognized options for a package will be silently ignored by brew.
salt '*' pkg.install <package name> tap='<tap>' salt '*' pkg.install php54 taps='["josegonzalez/php", "homebrew/dupes"]' options='["--with-fpm"]'
pkgs   A list of formulas to install. Must be passed as a python list.
salt '*' pkg.install pkgs='["foo","bar"]'
salt '*' pkg.install 'package package package'
salt.modules.mac_brew_pkg.latest_version(*names, **kwargs) Return the latest version of the named package available for upgrade or installation
salt.modules.mac_brew_pkg.list_pkgs(versions_as_list=False, **kwargs) List the packages currently installed in a dict:
salt.modules.mac_brew_pkg.list_upgrades(refresh=True, **kwargs) Check whether or not an upgrade is available for all packages
salt.modules.mac_brew_pkg.pin(name=None, pkgs=None, sources=None, **kwargs) Set package in 'hold' state, meaning it will not be upgraded.
salt.modules.mac_brew_pkg.refresh_db(**kwargs) Update the homebrew package repository.
salt.modules.mac_brew_pkg.remove(name=None, pkgs=None, **kwargs) Removes packages with brew uninstall.
salt.modules.mac_brew_pkg.unhold(name=None, pkgs=None, sources=None, **kwargs) Set package current in 'hold' state to install state, meaning it will be upgraded.
name The name of the package, e.g., 'tmux'
salt.modules.mac_brew_pkg.unpin(name=None, pkgs=None, sources=None, **kwargs) Set package current in 'hold' state to install state, meaning it will be upgraded.
salt.modules.mac_brew_pkg.upgrade(refresh=True, **kwargs) Upgrade outdated, unpinned brews.
refresh Fetch the newest version of Homebrew and all formulae from GitHub before installing.
salt.modules.mac_brew_pkg.upgrade_available(pkg, **kwargs) Check whether or not an upgrade is available for a given package
salt.modules.mac_brew_pkg.version(*names, **kwargs) Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned.
salt '*' pkg.version <package name> salt '*' pkg.version <package1> <package2> <package3>
salt.modules.mac_desktop macOS implementations of various commands in the "desktop" interface
salt.modules.mac_desktop.get_output_volume() Get the output volume (range 0 to 100)
salt '*' desktop.get_output_volume
salt.modules.mac_desktop.lock() Lock the desktop session
salt '*' desktop.lock
salt.modules.mac_desktop.say(*words) Say some words.
words  The words to execute the say command with.
salt '*' desktop.say <word0> <word1> ... <wordN>
salt.modules.mac_desktop.screensaver() Launch the screensaver.
salt '*' desktop.screensaver
salt.modules.mac_desktop.set_output_volume(volume) Set the volume of sound.
volume The level of volume. Can range from 0 to 100.
salt '*' desktop.set_output_volume <volume>
salt.modules.mac_group Manage groups on Mac OS 10.7+
salt.modules.mac_group.add(name, gid=None, **kwargs) Add the specified group
salt.modules.mac_group.adduser(group, name) Add a user in the group.
salt.modules.mac_group.chgid(name, gid) Change the gid for a named group
salt.modules.mac_group.delete(name) Remove the named group
salt.modules.mac_group.deluser(group, name) Remove a user from the group
salt.modules.mac_group.getent(refresh=False) Return info on all groups
salt.modules.mac_group.info(name) Return information about a group
salt.modules.mac_group.members(name, members_list) Replaces members of the group with a provided list.
Replaces a membership list for a local group 'foo'.
salt.modules.mac_keychain Install certificates into the keychain on Mac OS
salt.modules.mac_keychain.get_default_keychain(user=None, domain='user') Get the default keychain
user   The user to check the default keychain of
domain The domain to use valid values are user|system|common|dynamic, the default is user
salt '*' keychain.get_default_keychain
salt.modules.mac_keychain.get_friendly_name(cert, password) Get the friendly name of the given certificate
cert   The certificate to install
password The password for the certificate being installed formatted in the way described for openssl command in the PASS PHRASE ARGUMENTS section
Note: The password given here will show up as plaintext in the returned job info.
salt '*' keychain.get_friendly_name /tmp/test.p12 test123
salt.modules.mac_keychain.get_hash(name, password=None) Returns the hash of a certificate in the keychain.
name   The name of the certificate (which you can get from keychain.get_friendly_name) or the location of a p12 file.
password The password that is used in the certificate. Only required if your passing a p12 file.  Note: This will be outputted to logs
salt '*' keychain.get_hash /tmp/test.p12 test123