Skip to content

feat: add incus/LXC connector #1368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 3.x
Choose a base branch
from

Conversation

romain-dartigues
Copy link
Contributor

Dear pyinfra,

I started adding a LinuxContainers / Incus connector.
It is much a work in progress and I would appreciate feedback.

Actually it can:

  • work with local or remote incus/lxc server
  • execute action on all instances of the targeted incus/lxc server

It relies on the agent to be running on the targeted instance, when not the case it won't be able to do much more than getting it's name from the list and it's IPv4 address if there is one.

Examples:

# on remote servers:
pyinfra @incus/incus.example.net:instance_name files.get src=/tmp/n.log dest=n.log

pyinfra --debug -vvv --dry @incus/incus.example.net: fact server.LinuxName

# same, but target the local server
pyinfra @incus/instance_name files.get src=/tmp/n.log dest=n.log
pyinfra --debug -vvv --dry @incus/ fact server.LinuxName

@romain-dartigues romain-dartigues force-pushed the rdartigues/connectors branch 2 times, most recently from 1b406fc to c588555 Compare June 3, 2025 18:02
@romain-dartigues
Copy link
Contributor Author

Obviously I did my code without looking around...
Refs: #677, #1282

@Fizzadar
Copy link
Member

Hi @romain-dartigues! Thank you for PR-ing this, it's great to see the connector API being used more and more!

As with the PRs linked above I'm not going to merge this into pyinfra core, however, because I would like to reduce the number of connectors that are maintained within pyinfra itself (I am thinking v4 will only contain @ssh and @docker and will move all others into their own packages).

It probably makes most sense to merge any improvements on https://github.com/opekar/pyinfra-connector-lxcssh there to avoid furhter duplicate effort.

@romain-dartigues
Copy link
Contributor Author

Dear @Fizzadar, thank you for your message!
I didn't want to put too much effort if there were no interest from the community.

Could we have an "official" way to propose/reference connectors, examples, etc. maybe like how https://github.com/sphinx-contrib/ is doing.

Also, regarding connectors, I'd like to ask you to please think of an easier way to "plug" them (for Pyinfra 4 maybe?).
It is so "simple" to run pyinfra remote.example.net my/tasks.py it feel disappointing the way it is currently done...
Available to talk about potential design on IRC or here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants