Add best-effort Ansible module bridge operation#1557
Open
JakkuSakura wants to merge 6 commits intopyinfra-dev:3.xfrom
Open
Add best-effort Ansible module bridge operation#1557JakkuSakura wants to merge 6 commits intopyinfra-dev:3.xfrom
JakkuSakura wants to merge 6 commits intopyinfra-dev:3.xfrom
Conversation
Fizzadar
reviewed
Mar 25, 2026
Member
Fizzadar
left a comment
There was a problem hiding this comment.
Woa this is wild @JakkuSakura! SUPER interesting. Should we merge this against 3.x? There's nothing 4-specific here?
Contributor
Author
|
Seems like 3.x is fine. Let me rebase |
Contributor
|
what's the current state of this PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ansible.module(...)that executes real Ansible modules on the target host (upload module + ansiblemodule_utils/_vendor, run with stdin JSON)pyinfra[ansible]and includeansiblein test depsansible.modulewithansible.builtin.pingpyinfra.operations.*when resolving CLI operation namesHow To Use
Python deploy:
ansible.module(src="examples/ansible_modules/ping.py", kwargs={"data": "pyinfra"})CLI:
pyinfra -y -v @local ansible.module examples/ansible_modules/ping.py data=pyinfraAnsible Module Included
examples/ansible_modules/ping.pyis the upstreamansible.builtin.pingmodule (from ansible/ansible)data(default:pong) and returns{"ping": <data>}viaexit_jsonNotes
pyinfra[ansible]PYINFRA_E2E_SSH_LOCALHOST=1Validation
uv run pytest tests/test_operations_ansible.pyuv run pytest tests/test_operations.py -k ansible_moduleuv run pytest -m end_to_end_local -k ansibleuv run pyinfra -y -v localhost --ssh-user $(whoami) --ssh-key ~/.ssh/id_ed25519 --data ssh_allow_agent=false --data ssh_known_hosts_file=/dev/null --data ssh_strict_host_key_checking=no ansible.module examples/ansible_modules/ping.py data=pyinfra