Open benoitjpnet opened 2 years ago
I'd like to have this and have the connectors somehow composable, as the machine I am running pyinfra from ISN'T one of those running lxc. Due to that, lxcssh (or something would be also nice to have.
I might tackle writing something for my use, although as my use is really (at the moment at least) limited I'm tempted just skipping pyinfra and doing stuff by hand :-) Still, keeping an eye on this issue.
I suppose one option would be just writing pyinfra stuff which ssh's pyinfra configs to machines, and then runs them with lxc connector if any; without lxc connector, it could also copy them to the lxc container and run pyinfra there but I'd rather not install pyinfra in N places if one is enough.
The @dockerssh
connector implements this kind of thing, but it's not a composable combination of @ssh
and @docker
connectors (which would be awesome to have).
I don't know which approach is better, but the LXD project maintains an official Python SDK
https://github.com/lxc/pylxd/blob/master/setup.cfg#L16
Shelling out to lxc
works fine, as well. This is how the Puppet Bolt integration was created for LXD. That was Ruby, though, so using an official library wasn't an option.
Both have their advantages. Relying on the lxc
binary works, and is simpler, but usage of the SDK would likely make implementing an @lxdssh
feature easier? idk.
@Fizzadar What's your preference regarding taking on python deps?
Hello,
The goal would be to have a LXD connector so we can use it like:
In the back-end it should probably use
lxc exec <containerName> -- <command>
Related: #388
Thanks,