salt.states.lxc.
absent
(name, stop=False, path=None)¶Ensure a container is not present, destroying it if present
stop before destroying default: false
2015.5.2 新版功能.
path to the container parent default: /var/lib/lxc (system default)
2015.8.0 新版功能.
web01:
lxc.absent
salt.states.lxc.
cloned
(name, orig, snapshot=True, size=None, vgname=None, path=None, profile=None)¶2015.5.0 版后已移除: Use lxc.present
salt.states.lxc.
created
(name, **kwargs)¶2015.5.0 版后已移除: Use lxc.present
salt.states.lxc.
edited_conf
(name, lxc_conf=None, lxc_conf_unset=None)¶警告
This state is unsuitable for setting parameters that appear more than once in an LXC config file, or parameters which must appear in a certain order (such as when configuring more than one network interface). It is slated to be replaced, and as of version 2015.5.0 it is deprecated.
Edit LXC configuration options
path to the container parent default: /var/lib/lxc (system default)
2015.8.0 新版功能.
setconf:
lxc.edited_conf:
- name: ubuntu
- lxc_conf:
- network.ipv4.ip: 10.0.3.6
- lxc_conf_unset:
- lxc.utsname
salt.states.lxc.
frozen
(name, start=True, path=None)¶2015.5.0 新版功能.
Ensure that a container is frozen
注解
This state does not enforce the existence of the named container, it
just freezes the container if it is running. To ensure that the named
container exists, use lxc.present
.
path to the container parent default: /var/lib/lxc (system default)
2015.8.0 新版功能.
False
, then this state will
fail if the container is not running.web01:
lxc.frozen
web02:
lxc.frozen:
- start: False
salt.states.lxc.
present
(name, running=None, clone_from=None, snapshot=False, profile=None, network_profile=None, template=None, options=None, image=None, config=None, fstype=None, size=None, backing=None, vgname=None, lvname=None, path=None)¶在 2015.8.0 版更改: The lxc.created
state has been renamed
to lxc.present
, and the lxc.cloned
state has been merged into this state.
Create the named container if it does not exist
path to the container parent default: /var/lib/lxc (system default)
2015.8.0 新版功能.
True
, ensure that the container is runningFalse
, ensure that the container is stoppedNone
, do nothing with regards to the running state of the
container2015.8.0 新版功能.
clone_from
.Network Profile to use in container creation (see the LXC Tutorial for more information). Values in a profile will be overridden by the parameters listed below.
2015.5.2 新版功能.
Container Creation Arguments
The template to use. E.g., 'ubuntu' or 'fedora'. Conflicts with the
image
argument.
注解
The download
template requires the following three parameters
to be defined in options
:
The available images can be listed using the lxc.images
function.
options
2015.5.0 新版功能.
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:
web01: lxc.present: - template: download - options: dist: centos release: 6 arch: amd64Remember to double-indent the options, due to how PyYAML works.
template
argument.lvm
to use an LVM group.
Defaults to filesystem within /var/lib/lxc.backing
is set to
lvm
.backing
is set to lvm
.backing
is set to lvm
.salt.states.lxc.
running
(name, restart=False, path=None)¶在 2015.5.0 版更改: The lxc.started
state has been renamed
to lxc.running
Ensure that a container is running
注解
This state does not enforce the existence of the named container, it
just starts the container if it is not running. To ensure that the
named container exists, use lxc.present
.
path to the container parent default: /var/lib/lxc (system default)
2015.8.0 新版功能.
web01:
lxc.running
web02:
lxc.running:
- restart: True
salt.states.lxc.
set_pass
(name, **kwargs)¶2015.5.0 版后已移除.
This state function has been disabled, as it did not conform to design
guidelines. Specifically, due to the fact that lxc.set_password
uses chpasswd(8)
to set the password,
there was no method to make this action idempotent (in other words, the
password would be changed every time). This makes this state redundant,
since the following state will do the same thing:
setpass:
module.run:
- name: set_pass
- m_name: root
- password: secret
salt.states.lxc.
started
(name, path=None, restart=False)¶2015.5.0 版后已移除: Use lxc.running
salt.states.lxc.
stopped
(name, kill=False, path=None)¶Ensure that a container is stopped
注解
This state does not enforce the existence of the named container, it
just stops the container if it running or frozen. To ensure that the
named container exists, use lxc.present
, or use the lxc.absent
state to ensure that the container does not
exist.
path to the container parent default: /var/lib/lxc (system default)
2015.8.0 新版功能.
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.
2015.5.0 新版功能.
web01:
lxc.stopped