From bb355e6ccd6a465464f6b4c324a3f0c2be0ac957 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Sat, 12 Mar 2016 15:55:59 -0500 Subject: [PATCH] add container name to return and document return fixes #1848 --- .../modules/extras/cloud/lxc/lxc_container.py | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/extras/cloud/lxc/lxc_container.py b/lib/ansible/modules/extras/cloud/lxc/lxc_container.py index 6c177552d6..15347038c6 100644 --- a/lib/ansible/modules/extras/cloud/lxc/lxc_container.py +++ b/lib/ansible/modules/extras/cloud/lxc/lxc_container.py @@ -381,6 +381,48 @@ EXAMPLES = """ - test-container-new-archive-destroyed-clone """ +RETURN=""" +lxc_container: + description: container information + returned: success + type: list + contains: + name: + description: name of the lxc container + returned: success + type: string + sample: test_host + init_pid: + description: pid of the lxc init process + returned: success + type: int + sample: 19786 + interfaces: + description: list of the container's network interfaces + returned: success + type: list + sample: [ "eth0", "lo" ] + ips: + description: list of ips + returned: success + type: list + sample: [ "10.0.3.3" ] + state: + description: resulting state of the container + returned: success + type: string + sample: "running" + archive: + description: resulting state of the container + returned: success, when archive is true + type: string + sample: "/tmp/test-container-config.tar", + clone: + description: if the container was cloned + returned: success, when clone_name is specified + type: boolean + sample: True +""" try: import lxc @@ -880,7 +922,8 @@ class LxcContainerManagement(object): 'interfaces': self.container.get_interfaces(), 'ips': self.container.get_ips(), 'state': self._get_state(), - 'init_pid': int(self.container.init_pid) + 'init_pid': int(self.container.init_pid), + 'name' : self.container_name, } def _unfreeze(self):