andreasscherbaum / ansible-lxc-ssh

Ansible connection plugin using ssh + lxc-attach

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can you provide a real example of use?

BarbzYHOOL opened this issue · comments

commented

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

I'm sorry, your text confuses me. Which problem are you trying to solve?

The plugin itself is not using ssh, so I don't know where your ssh error message is coming from.

The example task shows how to create a container, because it is necessary to redirect the task to the host running the containers. At this point the container is not yet created, therefore the plugin cannot connect to the container itself.

Did you try to follow the description in the README?

commented

It's a plugin to create a LXC container??

I've read the readme like 20 times and this is the description:

This plugin allows to use Ansible on a remote server hosting LXC containers, without having to install SSH servers in each LXC container.

Doesn't it mean that we can enter the LXC container from the host with ansible? But the example given in the readme creates a container. I already have my container created though

There are more examples in the README, but they are short, and show how you configure Ansible to use this plugin to connect to a container. It's really just specifying this plugin for a connection, and then use the container like any other host in your playbook. No ssh is required, the plugin will use the commandline tools to manage the connection.

The one extra example (the playbook) shows how you can create a container, because obviously you can't connect to a container if it does not yet exist.

commented

#8

this is about ssh

anyway thank you for your answers i still don't understand what to do with it, maybe because I don't have the lxc command available though