Closed erikspigle-payroc closed 2 months ago
if we replace "ghcr.io/devcontainers-contrib/features/ansible:2": {}, "mcr.microsoft.com/vscode/devcontainers/ansible:latest": {}, in the devcontainer.json does it work better?
Tried this in another project, does not seem to resolve:
[4836 ms] Start: Run: docker inspect --type image mcr.microsoft.com/devcontainers/base:ubuntu-22.04
[5418 ms] Resolving Feature dependencies for 'mcr.microsoft.com/vscode/devcontainers/ansible:latest'...
[5418 ms] * Processing feature: mcr.microsoft.com/vscode/devcontainers/ansible:latest
[5531 ms] Could not resolve Feature manifest for 'mcr.microsoft.com/vscode/devcontainers/ansible:latest'. If necessary, provide registry credentials with 'docker login <registry>'.
[5531 ms] Github feature.
[5531 ms] Could not resolve Feature 'mcr.microsoft.com/vscode/devcontainers/ansible:latest'. Ensure the Feature is published and accessible from your current environment.
[5532 ms] Error: ERR: Feature 'mcr.microsoft.com/vscode/devcontainers/ansible:latest' could not be processed. You may not have permission to access this Feature, or may not be logged in. If the issue persists, report this to the Feature author.
[5532 ms] at yeA (/root/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:285:9703)
[5532 ms] at processTicksAndRejections (node:internal/process/task_queues:96:5)
[5532 ms] at async OC (/root/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:285:12273)
[5532 ms] at async Rc (/root/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:285:12501)
[5532 ms] at async Gc (/root/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:390:1821)
[5532 ms] at async XC (/root/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:393:2228)
[5532 ms] at async mtA (/root/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:465:2425)
[5532 ms] at async Pm (/root/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:465:1856)
[5532 ms] at async NH (/root/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:465:610)
[5532 ms] at async KtA (/root/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:482:3771)
[5542 ms] Exit code 1
.devcontainer/Dockerfile
# Copyright 2023-2024 Broadcom. All Rights Reserved.
# SPDX-License-Identifier: BSD-2
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04
# Install additional packages unavailable in the base image or as a feature.
# Note: Unable to be installed used the "postCreateCommand" option.
RUN apt-get update && \
apt-get install -y jq xorriso whois && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
.devcontainer/devcontainer.json
{
"name": "Packer Examples for vSphere",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/powershell": {},
"ghcr.io/devcontainers-contrib/features/packer-asdf": {},
"ghcr.io/devcontainers-contrib/features/terraform-asdf": {},
"ghcr.io/gickis/devcontainer-features/gomplate": {}
},
"postCreateCommand": "pwsh -Command 'Write-Host PowerShell Installed' && ansible --version && packer --version && terraform --version && gomplate --version",
"customizations": {
"vscode": {
"extensions": [
"EditorConfig.EditorConfig",
"esbenp.prettier-vscode",
"GitHub.remotehub",
"GitHub.vscode-pull-request-github",
"GitLab.gitlab-workflow",
"hashicorp.hcl",
"hashicorp.terraform",
"ms-vscode.powershell",
"redhat.ansible",
"streetsidesoftware.code-spell-checker"
]
}
}
}
Running the postCreateCommand from devcontainer.json...
[260298 ms] Start: Run in container: /bin/sh -c pwsh -Command 'Write-Host PowerShell Installed' && ansible --version && packer --version && terraform --version && gomplate --version
PowerShell Installed
ansible 2.10.8
config file = None
configured module search path = ['/home/vscode/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0]
Packer v1.11.2
Terraform v1.9.4
on linux_amd64
gomplate version 4.1.0
Done. Press any key to close the terminal.
Awaiting an update from OP, @erikspigle-payroc.
Dunno for @erikspigle-payroc , but I got an error :
[53367 ms] Start: Run in container: /bin/sh -c pwsh -Command 'Write-Host PowerShell Installed' && ansible --version && packer --version && terraform --version && gomplate --version PowerShell Installed /bin/sh: 1: ansible: not found [54181 ms] postCreateCommand failed with exit code 127. Skipping any further user-provided commands. Done. Press any key to close the terminal.
That said, the container starts but ansible is not available, because I think there's no command to install it in your Dockerfile/devcontainer.json
I manage to install it (not fully tested) with this Dockerfile :
# Copyright 2023-2024 Broadcom. All Rights Reserved.
# SPDX-License-Identifier: BSD-2
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04
# Install additional packages unavailable in the base image or as a feature.
# Note: Unable to be installed used the "postCreateCommand" option.
RUN apt-get update && \
apt-get install -y jq xorriso whois python3-pip && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install --no-cache-dir ansible==10.3.0
PS : The ansible devcontainer feature is buggy : https://github.com/devcontainers-contrib/features/issues/607
Resolved in #967.
I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Code of Conduct
Project Version
latest
VMware vSphere
N/A
HashiCorp Packer
N/A
HashiCorp Packer Plugin for VMware vSphere
N/A
Guest Operating System
Ubuntu Server 22.04 LTS
Environment Details
Building as a dev container in the latest VS Code and latest Docker Desktop using the current .devcontainer definitions on the most currently patched Windows 11.
Description
It seems there are problems with the referenced ansible feature for the dev container. While this project has nothing to do with maintaining that ansible feature, it should be considered to install ansible in a different way as that project is broken and hasn't been touched in closing in on a year. It has been months since any code has been maintained in that project:
https://github.com/devcontainers-contrib/features/tree/main/src/ansible
Expected Behavior
dev container building successfully with no failures.
Actual Behavior
The dev container is failing to build due to reliance on feature installed by "https://github.com/devcontainers-contrib/features/tree/main/src/ansible".
Steps to Reproduce
Either build out a dev container using the spec in this project, or build a net new dev container in VS Code and use Ubuntu as the base OS, and then choose the ansible feature that gets installed from here: https://github.com/devcontainers-contrib/features/tree/main/src/ansible as an additional feature. It will fail in the same way, either way.
Log Fragments and Files
Log entries of the failure to build:
Screenshots
No response
Additional Context
I think the real ask is to not rely on this ansible feature for the dev container build (as it seems to be an abandoned project) and to maybe install ansible in another way for the dev container buildout.