We setup a devcontainer environment to work with ansible in VS Code.
You'll need docker or podman to run the devcontainer. I'm using Docker Desktop for Windows.
I made a video on devcontainers here: • Remote Development with Docker Devcontaine...
GitHub Repo: https://github.com/sysengquick/ansible