chifflier / ansible-lxc-ssh Goto Github PK
View Code? Open in Web Editor NEWAnsible connection plugin using ssh + lxc-attach
Ansible connection plugin using ssh + lxc-attach
$ ansible -i inventory dltest -m apt -a "name=wget state=present" -vvvv
Loading callback plugin minimal of type stdout, v2.0 from /usr/local/lib/python2.7/dist-packages/ansible/plugins/callback/__init__.pyc
Using module file /usr/local/lib/python2.7/dist-packages/ansible/modules/core/packaging/os/apt.py
XXX exec_command: /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1478807384.4-192196860889135 `" && echo ansible-tmp-1478807384.4-192196860889135="` echo $HOME/.ansible/tmp/ansible-tmp-1478807384.4-192196860889135 `" ) && sleep 0'
XXX connect
[DEPRECATION WARNING]: ansible.utils.unicode.to_bytes is deprecated. Use ansible.module_utils._text.to_bytes instead.
This feature will be removed in version 2.4.
Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: ansible.utils.unicode.to_unicode is deprecated. Use ansible.module_utils._text.to_text instead.
This feature will be removed in version 2.4.
Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
<x.y.z.109> SSH: EXEC ssh -C -vvv -o ForwardAgent=yes -o 'IdentityFile="/home/user/.ssh/keys/key-201511"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -tt x.y.z.109 'lxc exec dltest -- /bin/sh -c '"'"'/bin/sh -c '"'"'"'"'"'"'"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1478807384.4-192196860889135 `" && echo ansible-tmp-1478807384.4-192196860889135="` echo $HOME/.ansible/tmp/ansible-tmp-1478807384.4-192196860889135 `" ) && sleep 0'"'"'"'"'"'"'"'"''"'"''
XXX connect
<x.y.z.109> PUT /tmp/tmpy2jk8V TO /root/.ansible/tmp/ansible-tmp-1478807384.4-192196860889135/apt.py
XXX close
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 119, in run
res = self._execute()
File "/usr/local/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 490, in _execute
result = self._handler.run(task_vars=variables)
File "/usr/local/lib/python2.7/dist-packages/ansible/plugins/action/normal.py", line 33, in run
results = merge_hash(results, self._execute_module(tmp=tmp, task_vars=task_vars))
File "/usr/local/lib/python2.7/dist-packages/ansible/plugins/action/__init__.py", line 593, in _execute_module
self._transfer_data(remote_module_path, module_data)
File "/usr/local/lib/python2.7/dist-packages/ansible/plugins/action/__init__.py", line 299, in _transfer_data
self._transfer_file(afile, remote_path)
File "/usr/local/lib/python2.7/dist-packages/ansible/plugins/action/__init__.py", line 276, in _transfer_file
self._connection.put_file(local_path, remote_path)
File "/opt/tmp/vagrant/homelab/ansible-lxc-ssh/lxc_ssh.py", line 564, in put_file
if scp_if_ssh in BOOLEANS:
NameError: global name 'BOOLEANS' is not defined
dltest | FAILED! => {
"failed": true,
"msg": "Unexpected failure during module execution.",
"stdout": ""
}
LXD support seems easy: just replace s/lxc-attach --name /lxc exec /
but there are some issues arising for some module like user or file transfer (lxc file push/pull).
Any plan for evolution?
Thanks
from ansible.compat.six
can't be found in latest Ansible, resulting in an error when using the plugin.
Looks like your connection plugin is the only one that enables ssh-less management of remote lxc containers. The Openstack one is unusable for some reason and there's zero documentation and the official lxc plugin doesn't support remote lxc containers.
Cheers
no matter if I install it with:
apt-get install python-six
or
pip install six
I get the error message in title.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.