fix(ansible): group names Ansible accepts, and interpreter discovery without the warning (#5334)
Every run warned twice because of Steward's own inventory: - 'Invalid characters were found in group names': the group 'Docker Swarm' went into the inventory as typed. ansible_group_name() cleans it to docker_swarm (lower case, [a-z0-9_], never a leading digit); two names that clean alike get _2, _3 so neither folds into the other. The group page says what plays call it. The display name is unchanged. - Python interpreter discovery: ansible_env sets ANSIBLE_PYTHON_INTERPRETER=auto_silent unless the environment already sets one; a target or group's ansible_python_interpreter still wins. Runs are scoped by target set (steward:group:<id>), not by group name, and --limit is free text, so neither path depends on the name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -316,9 +316,13 @@ def build_extra_vars_file(merged: dict | None, tmpdir: str) -> tuple[list[str],
|
||||
|
||||
|
||||
def ansible_env(creds: dict | None, base_env) -> dict:
|
||||
"""Return a copy of base_env with ANSIBLE_HOST_KEY_CHECKING set from creds."""
|
||||
"""Return a copy of base_env with ANSIBLE_HOST_KEY_CHECKING set from creds,
|
||||
and the interpreter found quietly (#5334): Ansible still discovers each
|
||||
host's Python, but no longer warns about it on every run. A target or group
|
||||
that sets ansible_python_interpreter still wins."""
|
||||
env = dict(base_env)
|
||||
env["ANSIBLE_HOST_KEY_CHECKING"] = "True" if (creds or {}).get("host_key_checking") else "False"
|
||||
env.setdefault("ANSIBLE_PYTHON_INTERPRETER", "auto_silent")
|
||||
return env
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user