mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit eacbf45632
)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
fc79283662
commit
a9cad80a36
1 changed files with 22 additions and 22 deletions
|
@ -1,19 +1,19 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2014, Kevin Carter <kevin.carter@rackspace.com>
|
# Copyright: (c) 2014, Kevin Carter <kevin.carter@rackspace.com>
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: lxc_container
|
module: lxc_container
|
||||||
short_description: Manage LXC Containers
|
short_description: Manage LXC Containers
|
||||||
description:
|
description:
|
||||||
- Management of LXC containers
|
- Management of LXC containers.
|
||||||
author: "Kevin Carter (@cloudnull)"
|
author: "Kevin Carter (@cloudnull)"
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
|
@ -53,7 +53,7 @@ options:
|
||||||
type: str
|
type: str
|
||||||
vg_name:
|
vg_name:
|
||||||
description:
|
description:
|
||||||
- If Backend store is lvm, specify the name of the volume group.
|
- If backend store is lvm, specify the name of the volume group.
|
||||||
type: str
|
type: str
|
||||||
default: lxc
|
default: lxc
|
||||||
thinpool:
|
thinpool:
|
||||||
|
@ -84,7 +84,7 @@ options:
|
||||||
type: str
|
type: str
|
||||||
lxc_path:
|
lxc_path:
|
||||||
description:
|
description:
|
||||||
- Place container under PATH
|
- Place container under PATH.
|
||||||
type: path
|
type: path
|
||||||
container_log:
|
container_log:
|
||||||
description:
|
description:
|
||||||
|
@ -109,26 +109,26 @@ options:
|
||||||
default: INFO
|
default: INFO
|
||||||
clone_name:
|
clone_name:
|
||||||
description:
|
description:
|
||||||
- Name of the new cloned server. This is only used when state is
|
- Name of the new cloned server.
|
||||||
clone.
|
- This is only used when state is clone.
|
||||||
type: str
|
type: str
|
||||||
clone_snapshot:
|
clone_snapshot:
|
||||||
description:
|
description:
|
||||||
- Create a snapshot a container when cloning. This is not supported
|
- Create a snapshot a container when cloning.
|
||||||
by all container storage backends. Enabling this may fail if the
|
- This is not supported by all container storage backends.
|
||||||
backing store does not support snapshots.
|
- Enabling this may fail if the backing store does not support snapshots.
|
||||||
type: bool
|
type: bool
|
||||||
default: 'no'
|
default: 'no'
|
||||||
archive:
|
archive:
|
||||||
description:
|
description:
|
||||||
- Create an archive of a container. This will create a tarball of the
|
- Create an archive of a container.
|
||||||
running container.
|
- This will create a tarball of the running container.
|
||||||
type: bool
|
type: bool
|
||||||
default: 'no'
|
default: 'no'
|
||||||
archive_path:
|
archive_path:
|
||||||
description:
|
description:
|
||||||
- Path the save the archived container. If the path does not exist
|
- Path the save the archived container.
|
||||||
the archive method will attempt to create it.
|
- If the path does not exist the archive method will attempt to create it.
|
||||||
type: path
|
type: path
|
||||||
archive_compression:
|
archive_compression:
|
||||||
choices:
|
choices:
|
||||||
|
@ -149,16 +149,17 @@ options:
|
||||||
- frozen
|
- frozen
|
||||||
- clone
|
- clone
|
||||||
description:
|
description:
|
||||||
- Define the state of a container. If you clone a container using
|
- Define the state of a container.
|
||||||
`clone_name` the newly cloned container created in a stopped state.
|
- If you clone a container using I(clone_name) the newly cloned
|
||||||
The running container will be stopped while the clone operation is
|
container created in a stopped state.
|
||||||
|
- The running container will be stopped while the clone operation is
|
||||||
happening and upon completion of the clone the original container
|
happening and upon completion of the clone the original container
|
||||||
state will be restored.
|
state will be restored.
|
||||||
type: str
|
type: str
|
||||||
default: started
|
default: started
|
||||||
container_config:
|
container_config:
|
||||||
description:
|
description:
|
||||||
- list of 'key=value' options to use when configuring a container.
|
- A list of C(key=value) options to use when configuring a container.
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
requirements:
|
requirements:
|
||||||
|
@ -188,7 +189,7 @@ notes:
|
||||||
name lxc-python2.
|
name lxc-python2.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = r"""
|
||||||
- name: Create a started container
|
- name: Create a started container
|
||||||
community.general.lxc_container:
|
community.general.lxc_container:
|
||||||
name: test-container-started
|
name: test-container-started
|
||||||
|
@ -371,7 +372,7 @@ EXAMPLES = """
|
||||||
- test-container-new-archive-destroyed-clone
|
- test-container-new-archive-destroyed-clone
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN = """
|
RETURN = r"""
|
||||||
lxc_container:
|
lxc_container:
|
||||||
description: container information
|
description: container information
|
||||||
returned: success
|
returned: success
|
||||||
|
@ -928,7 +929,6 @@ class LxcContainerManagement(object):
|
||||||
|
|
||||||
if self._container_exists(container_name=self.container_name, lxc_path=self.lxc_path):
|
if self._container_exists(container_name=self.container_name, lxc_path=self.lxc_path):
|
||||||
return str(self.container.state).lower()
|
return str(self.container.state).lower()
|
||||||
else:
|
|
||||||
return str('absent')
|
return str('absent')
|
||||||
|
|
||||||
def _execute_command(self):
|
def _execute_command(self):
|
||||||
|
|
Loading…
Reference in a new issue