Giter Club home page Giter Club logo

ansible-lxc-ssh's People

Contributors

andreasscherbaum avatar chifflier avatar dmp1ce avatar filcab avatar ilyaevseev avatar jantore avatar moqmar avatar stefangweichinger avatar timvy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ansible-lxc-ssh's Issues

Cannot detect lxc when installed as a Snap

Because I have installed lxd as a snap, the plugin cannot see lxc when it checks for it. As a result the plugin fails with Cannot identify LXC version.

Perhaps there is a more general way to address this with Ansible rather than solving the issue with the plugin. Maybe this is an Ansible issue. I'm not sure. Here is more information on the issue: https://www.reddit.com/r/ansible/comments/awjm0j/difference_between_path_while_manually_ssh_into/

Any help would be appreciated.

Error if lxc_host is numeric

I’m using this plugin with a proxmox server, which uses numbers as names for the containers. I upgraded the plugin for some reason, and it stopped working (i was using ansible_ssh_extra_args as container names in my inventory), with an exception saying that int objects don’t have a read method.

I fixed locally this problem by casting the call to self.get_option('lxc_host') to string, but it probably should be fixed in upstream.

lxc_ssh uses local unix username instead of ansible_user when connecting to host

Hello everybody
this is an upstream version of debops/debops#1731

The problem was reproduced with raw "ansible" command so we are pretty sure this is not a debops problem.

I will copy/paste the other bug report here, but some discussion have already taken place on the other side.

Hello
I am in the process of upgrading from 2.2.1 to 2.2.2

Most of my machines are LXC containers which I reach through lxc_ssh

  • my username on my control machine is jerros
  • the host machine is called monstro (monstro.daviel.idf.intranet)
  • the container is called build-yocto

When I attempt any playbook on build-yocto, I get a permisssion denied.

Interesting extract of my trace below:

jerros@logrus:~/comite_expertise/adminsys-ecs$ debops -l build-yocto service/apt -vvv
Running Ansible playbooks:
/home/jerros/comite_expertise/adminsys-ecs/debops/ansible/playbooks/service/apt.yml
(...)

PLAY [Manage Advanced Package Manager] *****************************************************************************************************************************************************************************
XXX connect
<monstro.daviel> ESTABLISH SSH CONNECTION FOR USER: root
<monstro.daviel> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=publickey,gssapi-with-mic,gssapi-keyex,hostbased -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/jerros/.ansible/cp/f16751a621 -tt monstro.daviel 'which lxc'
<monstro.daviel> (255, b'', b'[email protected]: Permission denied (publickey).\r\n')
<monstro.daviel> ssh_retry: attempt: 0, ssh return code is 255. cmd ([b'ssh', b'-C', b'-o', b'ControlMaster=auto', b'-o', b'ControlPersist=60s', b'-o', b'StrictHostKeyChecking=no', b'-o', b'KbdInteractiveAuthentication=no', b'-o', b'PreferredAuthentications=publickey,gssapi-with-mic,gssapi-keyex,hostbased', b'-o', b'PasswordAuthentication=no', b'-o', b'ConnectTimeout=10', b'-o', b'ControlPath=/home/jerros/.ansible/cp/f16751a621', b'-tt', b'monstro.daviel', b'which lxc']...), pausing for 0 seconds
<monstro.daviel> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=publickey,gssapi-with-mic,gssapi-keyex,hostbased -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/jerros/.ansible/cp/f16751a621 -tt monstro.daviel 'which lxc'
<monstro.daviel> (255, b'', b'[email protected]: Permission denied (publickey).\r\n')
<monstro.daviel> ssh_retry: attempt: 1, ssh return code is 255. cmd ([b'ssh', b'-C', b'-o', b'ControlMaster=auto', b'-o', b'ControlPersist=60s', b'-o', b'StrictHostKeyChecking=no', b'-o', b'KbdInteractiveAuthentication=no', b'-o', b'PreferredAuthentications=publickey,gssapi-with-mic,gssapi-keyex,hostbased', b'-o', b'PasswordAuthentication=no', b'-o', b'ConnectTimeout=10', b'-o', b'ControlPath=/home/jerros/.ansible/cp/f16751a621', b'-tt', b'monstro.daviel', b'which lxc']...), pausing for 1 seconds
<monstro.daviel> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=publickey,gssapi-with-mic,gssapi-keyex,hostbased -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/jerros/.ansible/cp/f16751a621 -tt monstro.daviel 'which lxc'
<monstro.daviel> (255, b'', b'[email protected]: Permission denied (publickey).\r\n')
<monstro.daviel> ssh_retry: attempt: 2, ssh return code is 255. cmd ([b'ssh', b'-C', b'-o', b'ControlMaster=auto', b'-o', b'ControlPersist=60s', b'-o', b'StrictHostKeyChecking=no', b'-o', b'KbdInteractiveAuthentication=no', b'-o', b'PreferredAuthentications=publickey,gssapi-with-mic,gssapi-keyex,hostbased', b'-o', b'PasswordAuthentication=no', b'-o', b'ConnectTimeout=10', b'-o', b'ControlPath=/home/jerros/.ansible/cp/f16751a621', b'-tt', b'monstro.daviel', b'which lxc']...), pausing for 3 seconds
<monstro.daviel> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=publickey,gssapi-with-mic,gssapi-keyex,hostbased -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/jerros/.ansible/cp/f16751a621 -tt monstro.daviel 'which lxc'
<monstro.daviel> (255, b'', b'[email protected]: Permission denied (publickey).\r\n')

TASK [Gathering Facts] *********************************************************************************************************************************************************************************************
task path: /home/jerros/comite_expertise/adminsys-ecs/debops/ansible/playbooks/service/apt.yml:7
fatal: [build-yocto]: FAILED! => 
  msg: |-
    Failed to connect to the host via ssh: [email protected]: Permission denied (publickey).

We see that the proble is that lxc_ssh attempts to connect to the host (monstro) using my local unix username (jerros) instead of using root (I can connect directly as root on that machine, I tested separately)

This used to work in 2.2.1 and reverting to debops 2.2.1 solves the problem

Also note the line <monstro.daviel> ESTABLISH SSH CONNECTION FOR USER: root so debops thinks it is attempting to connect as root, but seems to be connecting without a username, so using the default, local, username.

as a complement, a cutdown output of ansible-inventory for build-yocto

{
    "ansible_connection": "lxc_ssh",
    "ansible_host": "monstro.daviel",
    "ansible_ssh_extra_args": "{{inventory_hostname}}",
    "ansible_user": "root",
    "netbase__domain": "daviel.idf.intranet",
    "netbase__host_ipv4_address": "127.0.1.1",
}

Thx a lot
Jérémy

using sudo to run lxc-attach

Hi, I tried to fix this in a number of ways, but ended up adding "sudo" in front of every "lxc-attach" command in the plugin.

I really need to login as non-root as root login is disabled, and that trick makes it work.

It would be nice to maybe have that "sudo" as an option, or use the same "become" method...

Authentication or permission failure

All, I am very new to ansible. I'm not sure if this is an ansible error or an artifact of the lxc-ssh plugin. I have lxc 3.0.3 running on a server. On my laptop I have ansible 2.5.1 installed. I have ssh key authentication setup between my laptop and the server. My configuration files look like this:

/etc/ansible/hosts

[centos6-servers]                                                               
container1 ansible_host=stellarvelocity.com ansible_user=root ansible_connection=lxc_ssh ansible_ssh_extra_args=centos6-64-consolecraze

/etc/ansible/ansible.cfg

[defaults]                                                                    
connection_plugins = /usr/share/ansible/plugins

When I try to run the following command:

ansible container1 -m ping

I get the following error:

container1 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"` echo /tmp/ansible-tmp-1576882883.93-65515531639136 `\" && echo ansible-tmp-1576882883.93-65515531639136=\"` echo /tmp/ansible-tmp-1576882883.93-65515531639136 `\" ), exited with result 1, stdout output: Error: not found\r\n", 
    "unreachable": true
}

Scouring places like StackOverflow, I have repeatedly found the suggestion to change the remote_tmp param in ansible.cfg to something like /tmp which I tried but did not fix the issue.

Is this a plug-in issue, ansible issue, or newbie issue?

Module failure during Gathering Facts - C.ANSIBLE_SSH_CONTROL_PATH is None

I'm running Ansible 2.3.0.0 on MacOS and running plays against an Ubuntu 16.04 machine which hosts my LXC containers. I add the container via an add_host task. Later on when it goes to gather facts the lxc_ssh.py module fails with this traceback:

  File "/Users/username/ansible-project/connection_plugins/lxc_ssh.py", line 184, in _build_command
    to_bytes(C.ANSIBLE_SSH_CONTROL_PATH % dict(directory=cpdir)))
TypeError: unsupported operand type(s) for %: 'NoneType' and 'dict'

Looks like Ansible's ssh module changed around a bit in ansible/ansible@ac78347f specifically in lib/ansible/constants.py.

AttributeError: module 'ansible.constants' has no attribute 'ANSIBLE_SSH_CONTROL_PATH'

I started getting this error today after upgrading Ansible, I think. AttributeError: module 'ansible.constants' has no attribute 'ANSIBLE_SSH_CONTROL_PATH'

Ansible environment on Arch Linux:

$ ansible --version
ansible [core 2.11.0] 
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/david/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  ansible collection location = /home/david/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.9.4 (default, Apr 20 2021, 15:51:38) [GCC 10.2.0]
  jinja version = 2.11.3
  libyaml = True

My error:

The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 159, in run
    res = self._execute()
  File "/usr/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 533, in _execute
    self._connection = self._get_connection(cvars, templar)
  File "/usr/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 866, in _get_connection
    connection, plugin_load_context = self._shared_loader_obj.connection_loader.get_with_context(
  File "/usr/lib/python3.9/site-packages/ansible/plugins/loader.py", line 837, in get_with_context
    obj.__init__(instance, *args, **kwargs)
  File "/home/david/Workspace/my_project/connection_plugins/lxc_ssh.py", line 131, in __init__
    self.control_path = C.ANSIBLE_SSH_CONTROL_PATH
AttributeError: module 'ansible.constants' has no attribute 'ANSIBLE_SSH_CONTROL_PATH'
fatal: [omd2]: FAILED! => {
    "msg": "Unexpected failure during module execution.",
    "stdout": ""
}

"Failed to connect to the host via ssh: Permission denied (publickey,password).\r\n"

I cannot get the plugin to work. I have ansible installed inside a LXC container and want to use it to manage other containers. I have the following line in my hosts:

gigabyte ansible_connection=lxc_ssh ansible_ssh_extra_args=magento

(Gigabyte is the name of the host, it is reachable from within the LXC container with ssh gigabyte). However, where do I put username and password for the ssh to the host? I have tried the following line:

[all:vars]
ansible_user=lxcuser
ansible_pass=**** (removed)

What am I doing wrong? Please help!

Fetch task fails

Fetch task fails for me. Could this be another Python3 issue?

    - name: My backup task
      fetch:
        src: /tmp/myfile-{{ ansible_date_time.date }}.tar.gz
        dest: localbackups
The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/ansible/executor/task_executor.py", line 144, in run
    res = self._execute()
  File "/usr/lib/python3.7/site-packages/ansible/executor/task_executor.py", line 648, in _execute
    result = self._handler.run(task_vars=variables)
  File "/usr/lib/python3.7/site-packages/ansible/plugins/action/fetch.py", line 172, in run
    self._connection.fetch_file(source, dest)
  File "/home/david/Workspace/UpgradeYa/albatross-ansible/connection_plugins/lxc_ssh.py", line 1245, in fetch_file
    out_f.write(stdout)
TypeError: write() argument must be str, not bytes

fatal: [omd]: FAILED! => {
    "msg": "Unexpected failure during module execution.",
    "stdout": ""
}

Incompatible with ansible 2.4.0.0?

This plugin works great for me in ansible 2.2.1.0 (Debian stretch).

After upgrading to ansible 2.4.0.0 (still python 2.7.14) I can't get it to work anymore:

  1. Import from ansible.compat.six fails
    " ImportError: No module named six fatal"

  2. Type Error
    Since ansible.compat.six seems to be not available anymore I tried to change it to the regular "six" package by doing "from six import text_type, binary_type". The import works but later execution of the plugin fails with
    "
    line 184, in _build_command
    to_bytes(C.ANSIBLE_SSH_CONTROL_PATH % dict(directory=cpdir)))

TypeError: unsupported operand type(s) for %: 'NoneType' and 'dict'
"

Any pointers to get the plugin working again?

pipelining option has no description, causing ansible-doc to exit with an exception

In the documentation section, the pipelining option starting at line 270, has no 'description' key.
ansible-doc references that at line 509 of ../ansible/cli/doc.py (as supplied with debian buster ansible package 2.9.16+dfsg-1~bpo10+2)
I suspect that means both files have bugs? ie the option should have a description, and ansible-doc shouldn't crash if it doesn't

AttributeError: 'Connection' object has no attribute 'sshpass_pipe'

Having this issue using

$ ansible-playbook --version
ansible-playbook 2.7.8

I am using -k and a password.

TASK [robertdebock.bootstrap : register apk] ***********************************
task path: /home/tlc/playbooks/roles/robertdebock.bootstrap/tasks/main.yml:27
XXX connect
<reducto.home> ESTABLISH SSH CONNECTION FOR USER: root
<reducto.home> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=root -o ConnectTimeout=10 -o ControlPath=/home/tlc/.ansible/cp/00f460a8d5 -tt reducto.home 'which lxc'
The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 140, in run
    res = self._execute()
  File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 553, in _execute
    self._connection = self._get_connection(variables=variables, templar=templar)
  File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 846, in _get_connection
    ansible_playbook_pid=to_text(os.getppid())
  File "/usr/lib/python2.7/dist-packages/ansible/plugins/loader.py", line 397, in get
    obj = obj(*args, **kwargs)
  File "/home/tlc/playbooks/plugins/lxc_ssh.py", line 155, in __init__
    (returncode2, stdout2, stderr2) = self._exec_command("which lxc", None, False)
  File "/home/tlc/playbooks/plugins/lxc_ssh.py", line 1094, in _exec_command
    (returncode, stdout, stderr) = self._run(cmd, in_data, sudoable=sudoable)
  File "/home/tlc/playbooks/plugins/lxc_ssh.py", line 101, in wrapped
    return_tuple = func(self, *args, **kwargs)
  File "/home/tlc/playbooks/plugins/lxc_ssh.py", line 822, in _run
    return self._bare_run(cmd, in_data, sudoable, checkrc)
  File "/home/tlc/playbooks/plugins/lxc_ssh.py", line 585, in _bare_run
    os.close(self.sshpass_pipe[0])
AttributeError: 'Connection' object has no attribute 'sshpass_pipe'

fatal: [play1.home]: FAILED! => {}

MSG:

Unexpected failure during module execution.

Template module can't copy empty files

When trying to install an empty file using the template module, the Playbook hangs forever.

It works on a bare metal host, but not using this connection plugin.

The issue is in put_file() somewhere, but fetch_file() might be related (tbt).

Can you provide a real example of use?

Hello,

I really don't understand one bit how this plugin should work.

So I try this one but I really do'nt understand how to set it up.

container ansible_host=server ansible_connection=lxc_ssh ansible_ssh_extra_args=container

What does it mean? I must put the container id (vmid) where it's written "container" ? Or I must put the vmid in ansible_host variable ?

Do I need to remove my hypervisor's ip in my inventory? or do I need to have both?

I try this with or without passwords and it can't connect. I can connect with root without password, and it doesn't work. (it says fatal: [100]: FAILED! => {"msg": "Failed to connect to the host via ssh: Permission denied (publickey,password).\r\n"})


Can I put any task after that in my playbook?


Why does your task example create a LXC container while it's supposed to enter a LXC container??


There is a "lxd" and "lxc" plugin for ansible but of course they don't work since proxmox don't use "lxc" commands -__-

But the lxc-attach command should work. So should I still try to use that plugin?


This is extremely confusing

Issue connecting to container

I'm using the following config in my inventory/all
domain.net ansible_connection=lxc_ssh ansible_ssh_extra_args=joomla
and get the following error:

ansible domain.net -m ping -vvv
ansible 2.4.3.0
  config file = /Users/user/Documents/project/ansible/project/ansible.cfg
  configured module search path = ['/Users/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.4 (default, Mar  4 2018, 23:39:33) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]
Using /Users/user/Documents/project/ansible/project/ansible.cfg as config file
Parsed /Users/user/Documents/project/ansible/project/inventory/all inventory source with ini plugin
META: ran handlers
XXX connect
</user> ESTABLISH SSH CONNECTION FOR USER: None
The full traceback is:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 130, in run
    res = self._execute()
  File "/usr/local/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 485, in _execute
    self._connection = self._get_connection(variables=variables, templar=templar)
  File "/usr/local/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 735, in _get_connection
    connection = self._shared_loader_obj.connection_loader.get(conn_type, self._play_context, self._new_stdin)
  File "/usr/local/lib/python3.6/site-packages/ansible/plugins/loader.py", line 382, in get
    obj = obj(*args, **kwargs)
  File "/Users/user/Documents/project/ansible/project/connection_plugins/ansible-lxc-ssh/lxc_ssh.py", line 155, in __init__
    (returncode2, stdout2, stderr2) = self._exec_command("which lxc", None, False)
  File "/Users/user/Documents/project/ansible/project/connection_plugins/ansible-lxc-ssh/lxc_ssh.py", line 1092, in _exec_command
    cmd = self._build_command(ssh_executable, '-tt', self.host, cmd)
  File "/Users/user/Documents/project/ansible/project/connection_plugins/ansible-lxc-ssh/lxc_ssh.py", line 345, in _build_command
    self._split_args(self._play_context.ssh_args)]
  File "/Users/user/Documents/project/ansible/project/connection_plugins/ansible-lxc-ssh/lxc_ssh.py", line 229, in _split_args
    return [to_unicode(x.strip()) for x in shlex.split(to_bytes(argstring)) if x.strip()]
  File "/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/shlex.py", line 305, in split
    return list(lex)
  File "/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/shlex.py", line 295, in __next__
    token = self.get_token()
  File "/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/shlex.py", line 105, in get_token
    raw = self.read_token()
  File "/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/shlex.py", line 136, in read_token
    nextchar = self.instream.read(1)
AttributeError: 'bytes' object has no attribute 'read'

domain.net | FAILED! => {
    "msg": "Unexpected failure during module execution.",
    "stdout": ""
}

NB: I can successfully ansible domain.net -m ping -vvv when I set inventory/all to domain.net
Adding the ssh parameters fails as well.

Bug? (Maybe?) ssh command times out because of extra argument?

I am fairly new to Ansible, and very new to this plugin (but not new to Linux or Python,) so I'm not sure whether this is a "true bug" or a matter of "don't do that."

I am using lxc-ssh to maintain lxc containers running on a Proxmox machine. I got it working following this guide, with one change.

https://logan.protiumit.com/2016/10/13/ansible-lxc-connection.html

The change: in inventory/group_vars/containers.yml, comment out

#ansible_ssh_extra_args: "{{ container_name }}"

Reason: This causes the container name to be inserted as an argument in the ssh command, between ConnectTimeout and ControlPath, which causes the ssh command to time out. (On the first "which lxc" command.)

(Actually, I think it causes ssh to interpret the container name as the host for ssh to connect to, so if the container name is not a valid hostname/ip it times out, but if it is, it tries to connect. At one point I had tried this and was getting messages that lxc was not found, because it was ssh'ing directly to the container, which of course did not have lxc installed. But the debug output still showed the IP for the Proxmox machine, so that was confusing.)

I note the page above is dated 2016, and references the original lxc-ssh (not this fork,) so perhaps it is outdated information. Still, it is the best example I have found, so far. Anyway, the root cause:

lcc_ssh.py, starting at line 831 in _build_command, with this comment:

# Add in any common or binary-specific arguments from the PlayContext
# (i.e. inventory or task settings or overrides on the command line).

By running ansible with -vvvv I can see the ssh command, copy/paste it to my terminal, and see that it times out, then remove the extra arg (bare container name) between ConnectTimeout and ControlPath, and then it works. So I commented out the line in containers.yml setting ansible_ssh_extra_args, and then ansible works.

So is that a "bug" or a "don't do that" (setting ansible_ssh_extra_args to the container name in containers.yml?) Might those extra args be needed, in that position, in some other situation? Or should the code validate these for some format before injecting into the command? I am a Python programmer, but am too new to Ansible/plugins to say how or if it should be fixed. But anyway, it's working for me now, after some hours of head-scratching debugging and "Y U NO WORK?" raging. :)

Anyway, loving this plugin. The reasons I am using it (skip the rest if not interested in non-bug rambling:)

I have a Proxmox machine running containers. I am learning Terraform/Ansible with the goal of, provision with Terraform, maintain with Ansible, with NO MANUAL STEPS in between.

Problem is, every time I terraform destroy/apply to recreate a container, the hwaddr/ip/host key changes, so connecting directly via ssh causes "dns spoofing" warnings and requires manual removal of keys in known_hosts. (Even though terraform added my public key in container /root/.ssh/authorized_keys. But the host key changed.)

Using lxc_ssh solves that, as it just runs the commands via lxc-attach after ssh'ing to the Proxmox machine. Don't even need the container's root password for this.

Of course, it also solves the problem of some container images not running sshd, as the description of lxc-ssh says. Even so, I note that the alpine linux default container has neither sshd NOR Python, so I will be looking into the raw module to see if I can get python3 installed. I actually created a custom alpine container image including openssh and python3, but still I'd like to figure out how to make it work with a "stock" image.

Thank you for maintaining this plugin. It is possible I could contribute in the future, after I understand Ansible better.

Assumes that cgroup2 users are also systemd users

If a host uses cgroup2, the connection plugin will unconditionally try to execute commands via systemd-run.

Please check whether systemd-run exists before trying to use it (or, perhaps even better, whether pid1 is systemd). cgroup2 can also be used without systemd.

Python3 support

I'd like to add python3 support for this plugin (not a big deal, only 2 or 3 lines to correct) but shall I edit the plugin to test the python version or create another branch ?

Use with proxmox CTs

I hacked the plugin to manage Proxmox CT's using pct exec instead of lxc-attach. Would using lxc-attach be preferable or should I fork this and make a pct_ssh plugin?

Besides changing the underlying commands there were some quoting differences between the two.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.