fix: Make the playbook run cleanly outside AWX#6
Merged
Conversation
The inventory hard-coded `ansible_python_interpreter: /usr/bin/env python`, which fails on hosts without a bare `python` on PATH (e.g. macOS, or the uv venv) — even fact-gathering aborts with "The module interpreter '/usr/bin/env python' was not found". For a local connection the interpreter Ansible itself launched with is always correct and present, so use the `ansible_playbook_python` magic variable instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Several fixes so the playbook runs cleanly outside AWX against a real cluster: - TLS: load 'K8S_AUTH_VERIFY_SSL' (default 'yes') in prep.yaml and wire it into the k8s module_defaults as 'validate_certs', so clusters with a CA outside the local trust store (e.g. Scaleway) can be reached via 'K8S_AUTH_VERIFY_SSL=no'. - Facts: read the gathered date_time fact as 'ansible_facts.date_time.iso8601_micro' to clear the INJECT_FACTS_AS_VARS deprecation warning. - Collections: pin a project-local 'collections_path' so a stale 'kubernetes.core' in '~/.ansible/collections' can no longer shadow the uv-bundled version (silencing its deprecated module_utils._text imports). - Bump the nginx image tag to 1.31.2-alpine. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Fixes needed to run the playbook cleanly outside AWX against a real cluster.
Changes
Local interpreter (
inventory.yaml): replace the hard-codedansible_python_interpreter: "/usr/bin/env python"with{{ ansible_playbook_python }}. The old value fails on hosts without a barepythononPATH(macOS, or the uv venv) — even fact-gathering aborted with "The module interpreter '/usr/bin/env python' was not found."TLS verification (
tasks/prep.yaml,tasks/main.yaml): loadK8S_AUTH_VERIFY_SSL(defaultyes) and pass it to thek8smodule_defaultsasvalidate_certs. Lets clusters presenting a certificate signed by a CA outside the local trust store (e.g. Scaleway) be reached withK8S_AUTH_VERIFY_SSL=no, while keeping verification on by default.Fact access (
templates/deployment.yaml.j2): read the gathered fact asansible_facts.date_time.iso8601_micro, clearing theINJECT_FACTS_AS_VARSdeprecation warning (removed in ansible-core 2.24).Collections path (
ansible.cfg): pin a project-localcollections_pathso a stalekubernetes.core(2.3.0) in~/.ansible/collectionsno longer shadows the uv-bundled 6.4.0. The old version emitted deprecatedansible.module_utils._textimport warnings; the bundled one imports fromansible.module_utils.common.text.converters.Image bump (
vars/main.yaml): nginx1.29.4-alpine→1.31.2-alpine.Verification
uv run ansible-playbook site.yaml(withK8S_AUTH_*set andK8S_AUTH_VERIFY_SSL=no) now runs to completion against a Scaleway cluster with no deprecation warnings.yamllintpasses on all changed files.🤖 Generated with Claude Code