salt.runners.lxc

Control Linux Containers via Salt

depends:

lxc execution module

salt.runners.lxc.cloud_init(names, host=None, quiet=False, **kwargs)

Wrapper for using lxc.init in saltcloud compatibility mode

names

Name of the containers, supports a single name or a comma delimited list of names.

host

Minion to start the container on. Required.

path

path to the container parent default: /var/lib/lxc (system default)

New in version 2015.8.0.

saltcloud_mode

init the container with the saltcloud opts format instead

salt.runners.lxc.find_guest(name, quiet=False, path=None)

Returns the host for a container.

path

path to the container parent default: /var/lib/lxc (system default)

New in version 2015.8.0.

salt-run lxc.find_guest name
salt.runners.lxc.find_guests(names, path=None)

Return a dict of hosts and named guests

path

path to the container parent default: /var/lib/lxc (system default)

New in version 2015.8.0.

salt.runners.lxc.freeze(name, quiet=False, path=None)

Freeze the named container

path

path to the container parent default: /var/lib/lxc (system default)

New in version 2015.8.0.

salt-run lxc.freeze name
salt.runners.lxc.info(name, quiet=False, path=None)

Returns information about a container.

path

path to the container parent default: /var/lib/lxc (system default)

New in version 2015.8.0.

salt-run lxc.info name
salt.runners.lxc.init(names, host=None, saltcloud_mode=False, quiet=False, **kwargs)

Initialize a new container

salt-run lxc.init name host=minion_id [cpuset=cgroups_cpuset] \
        [cpushare=cgroups_cpushare] [memory=cgroups_memory] \
        [template=lxc_template_name] [clone=original name] \
        [profile=lxc_profile] [network_proflile=network_profile] \
        [nic=network_profile] [nic_opts=nic_opts] \
        [start=(true|false)] [seed=(true|false)] \
        [install=(true|false)] [config=minion_config] \
        [snapshot=(true|false)]
names

Name of the containers, supports a single name or a comma delimited list of names.

host

Minion on which to initialize the container (required)

path

path to the container parent default: /var/lib/lxc (system default)

New in version 2015.8.0.

saltcloud_mode

init the container with the saltcloud opts format instead See lxc.init_interface module documentation

cpuset

cgroups cpuset.

cpushare

cgroups cpu shares.

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.

template

Name of LXC template on which to base this container

clone

Clone this container from an existing container

profile

A LXC profile (defined in config or pillar).

network_profile

Network profile to use for the container

New in version 2015.5.2.

nic

Deprecated since version 2015.5.0: Use network_profile instead

nic_opts

Extra options for network interfaces. E.g.:

{"eth0": {"mac": "aa:bb:cc:dd:ee:ff", "ipv4": "10.1.1.1", "ipv6": "2001:db8::ff00:42:8329"}}

start

Start the newly created container.

seed

Seed the container with the minion config and autosign its key. 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.

salt.runners.lxc.list_(host=None, quiet=False, path=None)

List defined containers (running, stopped, and frozen) for the named (or all) host(s).

path

path to the container parent default: /var/lib/lxc (system default)

New in version 2015.8.0.

salt-run lxc.list [host=minion_id]
salt.runners.lxc.purge(name, delete_key=True, quiet=False, path=None)

Purge the named container and delete its minion key if present. WARNING: Destroys all data associated with the container.

path

path to the container parent default: /var/lib/lxc (system default)

New in version 2015.8.0.

salt-run lxc.purge name
salt.runners.lxc.start(name, quiet=False, path=None)

Start the named container.

path

path to the container parent default: /var/lib/lxc (system default)

New in version 2015.8.0.

salt-run lxc.start name
salt.runners.lxc.stop(name, quiet=False, path=None)

Stop the named container.

path

path to the container parent default: /var/lib/lxc (system default)

New in version 2015.8.0.

salt-run lxc.stop name
salt.runners.lxc.unfreeze(name, quiet=False, path=None)

Unfreeze the named container

path

path to the container parent default: /var/lib/lxc (system default)

New in version 2015.8.0.

salt-run lxc.unfreeze name