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:
@@ -105,7 +105,7 @@ ansible_cmd() {
|
|||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
. "$ANSIBLE_VENV"
|
. "$ANSIBLE_VENV"
|
||||||
cd "$ANSIBLE_DIR"
|
cd "$ANSIBLE_DIR"
|
||||||
ansible -i "$PPF_INVENTORY" "$@"
|
ansible -i "$PPF_INVENTORY" --become "$@"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ podman_cmd() {
|
|||||||
local host="$1"; shift
|
local host="$1"; shift
|
||||||
local cmd="$*"
|
local cmd="$*"
|
||||||
ansible_cmd "$host" -m raw -a \
|
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.
|
# Run a podman-compose subcommand on a remote host.
|
||||||
|
|||||||
Reference in New Issue
Block a user