lxc connection plugin

This commit is contained in:
Jörg Thalheim 2015-11-13 01:28:17 +01:00
parent f961f9f4d0
commit 88482234e6
No known key found for this signature in database
GPG key ID: CA4106B8D7CC79FA
3 changed files with 237 additions and 0 deletions

View file

@ -55,6 +55,24 @@ lxd-no-pipelining ansible_ssh_pipelining=false
ansible_host=centos-7-amd64
ansible_connection=lxd
[lxc]
lxc-pipelining ansible_ssh_pipelining=true
lxc-no-pipelining ansible_ssh_pipelining=false
[lxc:vars]
# 1. install lxc
# 2. install python2-lxc
# $ pip install git+https://github.com/lxc/python2-lxc.git
# 3. create container:
# $ sudo lxc-create -t download -n centos-7-amd64 -- -d centos -r 7 -a amd64
# 4. start container:
# $ sudo lxc-start -n centos-7-amd64 -d
# 5. run test:
# $ sudo -E make test_connection TEST_CONNECTION_FILTER=lxc
# 6. stop container
# $ sudo lxc-stop -n centos-7-amd64
ansible_host=centos-7-amd64
ansible_connection=lxc
[test_default:children]
local
chroot

View file

@ -30,6 +30,7 @@ from ansible.plugins.connection import ConnectionBase
#from ansible.plugins.connection.funcd import Connection as FuncdConnection
#from ansible.plugins.connection.jail import Connection as JailConnection
#from ansible.plugins.connection.libvirt_lxc import Connection as LibvirtLXCConnection
from ansible.plugins.connection.lxc import Connection as LxcConnection
from ansible.plugins.connection.local import Connection as LocalConnection
from ansible.plugins.connection.paramiko_ssh import Connection as ParamikoConnection
from ansible.plugins.connection.ssh import Connection as SSHConnection
@ -89,6 +90,9 @@ class TestConnectionBaseClass(unittest.TestCase):
# def test_libvirt_lxc_connection_module(self):
# self.assertIsInstance(LibvirtLXCConnection(), LibvirtLXCConnection)
def test_lxc_connection_module(self):
self.assertIsInstance(LxcConnection(self.play_context, self.in_stream), LxcConnection)
def test_local_connection_module(self):
self.assertIsInstance(LocalConnection(self.play_context, self.in_stream), LocalConnection)