salt.modules.lxc

Work with linux containers

depends:lxc package for distribution
salt.modules.lxc.create(name, config=None, profile=None, options=None, **kwargs)

Create a new container.

salt 'minion' lxc.create name [config=config_file] \
        [profile=profile] [template=template_name] \
        [backing=backing_store] [ vgname=volume_group] \
        [size=filesystem_size] [options=template_options]
name
Name of the container.
config
The config file to use for the container. Defaults to system-wide config (usually in /etc/lxc/lxc.conf).
profile
A LXC profile (defined in config or pillar).
template
The template to use. E.g., 'ubuntu' or 'fedora'.
backing
The type of storage to use. Set to 'lvm' to use an LVM group. Defaults to filesystem within /var/lib/lxc/.
vgname
Name of the LVM volume group in which to create the volume for this container. Only applicable if backing=lvm. Defaults to 'lxc'.
size
Size of the volume to create. Only applicable if backing=lvm. Defaults to 1G.
options
Template specific options to pass to the lxc-create command.
salt.modules.lxc.destroy(name)

Destroy the named container. WARNING: Destroys all data associated with the container.

salt '*' lxc.destroy name
salt.modules.lxc.exists(name)

Returns whether the named container exists.

salt '*' lxc.exists name
salt.modules.lxc.freeze(name)

Freeze the named container.

salt '*' lxc.freeze name
salt.modules.lxc.info(name)

Returns information about a container.

salt '*' lxc.info name
salt.modules.lxc.init(name, cpuset=None, cpushare=None, memory=None, nic='default', profile=None, **kwargs)

Initialize a new container.

salt 'minion' lxc.init name [cpuset=cgroups_cpuset] \
        [cpushare=cgroups_cpushare] [memory=cgroups_memory] \
        [nic=nic_profile] [profile=lxc_profile] \
        [start=(true|false)]
name
Name of the container.
cpuset
cgroups cpuset.
cpushare
cgroups cpu shares.
memory
cgroups memory limit, in MB.
nic
Network interfaces profile (defined in config or pillar).
profile
A LXC profile (defined in config or pillar).
start
If true, start the newly created container.
salt.modules.lxc.list_()

List defined containers (running, stopped, and frozen).

salt '*' lxc.list
salt.modules.lxc.start(name)

Start the named container.

salt '*' lxc.start name
salt.modules.lxc.state(name)

Returns the state of a container.

salt '*' lxc.state name
salt.modules.lxc.stop(name)

Stop the named container.

salt '*' lxc.stop name
salt.modules.lxc.unfreeze(name)

Unfreeze the named container.

salt '*' lxc.unfreeze name