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, stop=True)¶ Destroy the named container. WARNING: Destroys all data associated with the container.
salt '*' lxc.destroy name [stop=(true|false)]
-
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.
get_parameter
(name, parameter)¶ Returns the value of a cgroup parameter for a container.
salt '*' lxc.get_parameter name parameter
-
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)] [seed=(true|false)] \ [install=(true|false)] [config=minion_config]
- 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
- Start the newly created container.
- 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 paramers. By default, the id is set to the name of the container.
-
salt.modules.lxc.
list_
()¶ List defined containers (running, stopped, and frozen).
salt '*' lxc.list
-
salt.modules.lxc.
set_parameter
(name, parameter, value)¶ Set the value of a cgroup parameter for a container.
salt '*' lxc.set_parameter name parameter value
-
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