VS Code Ansible Extension

I like the Ansible Extension, but I am having some issues with the custom execution environment. Has anyone else have this issue?

This works great:

But if I have something with community collection or a custom built collection with a role. I can not find it. Even though I have that set in my Ansible Navigator settings.

I also have it set in the extension setting to point to the image name in podman images and enable the Execution Environment. When i do this though the linting and auto completion breaks for everything. And I get errors.

image
Pretty long command. Not sure what I am missing.

Let me know what other information you would need or am I just missing something obvious.

3 Likes

Hi @Jason
Happy to help here and nice to meet you virtually!!

The navigator settings and the code extension settings are separate, so even if you point though you point the navigator to the execution environment the code extension will not know about it.

You are on the correct path of changing the settings in code extension, but I will let you know the recommended way. Creator-ee has all the tools like linting and the right configuration for the code extension to work with execution environments, another thing is that we don’t want the users to create execution environments everytime they are working with a new collections and then change the settings in code extension.

To solve this, the code extension mounts the playbook adjacent collections to the creator-ee automatically, so for your projects point the code-extension back to the creator-ee and then create a dir called collections/ adjacent to the playbook you are running.

Then you can install any collection to the dir by using something like below

ansible-galaxy collection install google.cloud -p collections/

if you are creating collections locally make sure you are adding those collections to the same folder, the structure looks like this collections/ansible_collections/<namespace>/<collection_name>

Or you can directly init the collection in this folder using

ansible-galaxy collection init foo.bar --init-path collections/ansible_collections

Once done, the autocomplete on modules, plugin, roles etc from the installed and worked upon collections should start showing up in the code extension.

Hope this helps!!

7 Likes

Hi @Jason! It looks like the post might be solved - could you check to see if the response by @ansibehl worked for you?

If so, it would be super helpful if you could click the :heavy_check_mark: on their post to accept the solution - it helps users find solutions (solved topics have a higher search priority), recognises the input of the people who help you, helps our volunteers find new issues to answer, and keeps the forum nice and tidy. It’s just a nice way to give back, and only takes a moment :slight_smile:

Thanks!
(this is template reply, do feel free to reply if I’ve misunderstood the situation!)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.