Commit Graph
2 Commits
Author SHA1 Message Date
Slavi PantaleevandClaude Opus 5.5 415d784ca0 Find Ansible's interpreter also behind python-exec and wrapper scripts
On Gentoo, the shebang of `ansible-playbook` is the python-exec
dispatcher (`#!/usr/bin/python-exec2c`), which bin/ansible-python.sh
took for an interpreter, because its name starts with `python`.
python-exec only runs the programs it wraps, so every `just run…`
recipe failed with "no python-exec wrapped executable found".

Now only names like `python`, `python3` or `python3.14` are trusted.
For anything else (python-exec, wrapper scripts as on Nix), Ansible is
asked which interpreter it runs on (`ansible-playbook --version`),
before falling back to `python3`, which may lack PyYAML (e.g. in an
active virtualenv).

Same as https://github.com/mother-of-all-self-hosting/mash-playbook/commit/a685940a

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-25 13:33:34 +02:00
Slavi PantaleevandClaude Opus 5.5 a029d6f336 Add a way to run Python scripts with the interpreter which runs Ansible
bin/ansible-python.sh runs Python with the interpreter named in the
first line of `ansible-playbook`. That interpreter has PyYAML, since
Ansible depends on it, even when Ansible is installed in an environment
of its own (e.g. with pipx), where the system's `python3` may lack it.
If it is not a Python interpreter (e.g. `ansible-playbook` is a wrapper
script), or Ansible is missing, `python3` is used.

Role installation, which needs PyYAML, is the first to use it in the
next commit, so that it works without installing PyYAML separately.

The same script in mash-playbook (where its tests live):
https://github.com/mother-of-all-self-hosting/mash-playbook/commit/1fe0f90f

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-25 09:40:02 +02:00