If a user is developing in a devcontainer they should have all the necessary Ansible Development Tools "local" in their terminal and do not need to launch tools inside the execution environment. When ansible.executionEnvironment.enabled is set to true a container is launched everytime a file is opened or saved to run ansible-lint. While this works, it makes things slow. This can be disabled as part of the devcontainer file to improve the user experience while developing.
{
"name": "ansible-dev-container-podman",
"image": "ghcr.io/ansible/community-ansible-dev-tools:latest",
"containerUser": "root",
"runArgs": [
"--cap-add=SYS_ADMIN",
"--cap-add=SYS_RESOURCE",
// The following line stops the ansible-config mknod /dev/null errors
// "--cap-add=CAP_MKNOD",
"--device",
"/dev/fuse",
"--security-opt",
"seccomp=unconfined",
"--security-opt",
"label=disable",
"--security-opt",
"apparmor=unconfined",
"--userns=host",
"--hostname=ansible-dev-container",
"--volume",
"ansible-dev-tools-container-storage:/var/lib/containers",
],
"customizations": {
"vscode": {
"extensions": ["redhat.ansible", "redhat.vscode-redhat-account"],
"settings": {
"ansible.executionEnvironment.enabled": false
}
}
}
}
Testing the automation code with the execution environment can be accomplished using ansible-navigator.
ISSUE TYPE
SUMMARY
If a user is developing in a devcontainer they should have all the necessary Ansible Development Tools "local" in their terminal and do not need to launch tools inside the execution environment. When ansible.executionEnvironment.enabled is set to true a container is launched everytime a file is opened or saved to run ansible-lint. While this works, it makes things slow. This can be disabled as part of the devcontainer file to improve the user experience while developing.
Testing the automation code with the execution environment can be accomplished using ansible-navigator.