diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7250ddf..ef1c92e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,19 +1,15 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/python +// For format details, see https://aka.ms/devcontainer.json. { - "name": "Python 3", - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "name": "Ansible - Proxmox Post-Install", "image": "mcr.microsoft.com/devcontainers/python:3-3.14-trixie", - // Features to add to the dev container. More info: https://containers.dev/features. - "features": { - "ghcr.io/devcontainers-extra/features/ansible": {}, - "ghcr.io/hspaans/devcontainer-features/ansible-lint": {} - }, - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "pip3 install --user -r requirements.txt", - // Configure tool-specific properties. + + // Do NOT use separate devcontainer features for ansible and ansible-lint. + // Both features use pipx and create isolated venvs, so ansible-lint ends up + // with its own internal Ansible copy that cannot see externally installed + // collections — causing syntax-check failures even after collection install. + // Installing everything via pip into the shared base Python env solves this. + "postCreateCommand": "pip install --quiet ansible ansible-lint && ansible-galaxy collection install -r ansible/requirements.yaml", + "customizations": { "vscode": { "settings": { @@ -25,6 +21,4 @@ ] } } - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" }