ppf-common: fix ad-hoc ansible for toolkit inventory

Add --become to ansible_cmd (needed when connecting as
ansible user). Add cd /tmp to podman_cmd so sudo -u podman
doesn't fail on inaccessible /home/ansible cwd.
This commit is contained in:
Username
2026-02-17 23:38:13 +01:00
parent 8779979780
commit 7a271896a8

View File

@@ -105,7 +105,7 @@ ansible_cmd() {
# shellcheck disable=SC1090
. "$ANSIBLE_VENV"
cd "$ANSIBLE_DIR"
ansible -i "$PPF_INVENTORY" "$@"
ansible -i "$PPF_INVENTORY" --become "$@"
)
}
@@ -130,7 +130,7 @@ podman_cmd() {
local host="$1"; shift
local cmd="$*"
ansible_cmd "$host" -m raw -a \
"uid=\$(id -u podman) && sudo -u podman XDG_RUNTIME_DIR=/run/user/\$uid $cmd"
"uid=\$(id -u podman) && cd /tmp && sudo -u podman XDG_RUNTIME_DIR=/run/user/\$uid $cmd"
}
# Run a podman-compose subcommand on a remote host.