vscode-ansible icon indicating copy to clipboard operation
vscode-ansible copied to clipboard

Microsoft collections (microsoft.ad / microsoft.iis) modules recognized by ansible-doc but not by VSCode extension

Open raoulaime opened this issue 10 months ago • 3 comments

Summary

Hello,

I'm encountering an issue with the VSCode Ansible extension.

The microsoft.ad and microsoft.iis collections are correctly installed on my system and fully recognized by ansible-doc. For example:

ansible-doc microsoft.ad.user ansible-doc microsoft.iis.website

These commands return the expected documentation, meaning Ansible is able to locate and parse the modules correctly.

However, in VSCode, the Red Hat Ansible extension does not provide: - syntax highlighting, - module validation, - auto-completion, or hover documentation for these modules. It works perfectly fine for all other collections, including community and certified ones.

What I've verified: Collections are installed in the same Python environment used by VSCode FQCNs are used (microsoft.ad.user, microsoft.iis.website) ansible-lint and ansible are configured and work from the terminal inside VSCode ansible-doc works for the modules in question Extension settings are properly configured (ansible.useFullyQualifiedCollectionNames is set to true)

Request: Can support be added (or improved) for Microsoft collections such as microsoft.ad and microsoft.iis in the VSCode Ansible extension?

Thanks in advance for your support!

Extension version

redhat.ansible: 25.4.0

VS Code version

1.100.3

Ansible Version

$ansible --version                
ansible [core 2.18.5]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/.local/lib/python3.12/site-packages/ansible
  ansible collection location = /data/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.12.10 (main, May  9 2025, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-5)] (/usr/bin/python3)
  jinja version = 3.1.6
  libyaml = True

OS / Environment

Windows 10

Relevant log output


raoulaime avatar Jun 17 '25 16:06 raoulaime

Hi @raoulaime ! Can you provide an example of the playbook you're using?

Also, the other collections that are working, community and certified, are those also installed inside the same Python environment? I also recommend checking your Ansible extension settings for environment and verify that the expected Python env is used. You can also verify this at the bottom bar of the VS Code window.

alisonlhart avatar Jun 18 '25 12:06 alisonlhart

Hi @alisonlhart, All the collections are installed in the same python env.

Image

raoulaime avatar Jun 18 '25 13:06 raoulaime

$ ansible-galaxy collection list

Collection Version


ansible.posix 2.0.0
ansible.scm 3.0.0
ansible.security 3.0.0
ansible.utils 6.0.0
ansible.windows 3.1.0
awx.awx 24.6.1 azure.azcollection 3.5.0
chocolatey.chocolatey 1.5.3
cloud.terraform 3.1.0
community.crypto 2.26.3 community.general 11.0.0 community.windows 3.0.0
dynatrace.oneagent 1.2.4
infra.controller_configuration 3.1.2
infra.ee_utilities 4.0.0
microsoft.ad 1.9.1
microsoft.iis 1.0.2
trendmicro.deepsec 4.0.0

Also the debug when pointing mouse on the collection:

[Trace - 9:05:46 AM] Sending request 'textDocument/hover - (21)'. Params: { "textDocument": { "uri": "file:///home/user/lab/demo/playbook_syntx_highlighting.yml" }, "position": { "line": 11, "character": 17 } }

[Trace - 9:05:46 AM] Received response 'textDocument/hover - (21)' in 9ms. No result returned.

[Trace - 9:06:00 AM] Sending request 'textDocument/hover - (22)'. Params: { "textDocument": { "uri": "file:///home/user/lab/demo/playbook_syntx_highlighting.yml" }, "position": { "line": 18, "character": 17 } }

[Trace - 9:06:00 AM] Received response 'textDocument/hover - (22)' in 4ms. No result returned.

[Trace - 9:06:00 AM] Sending request 'textDocument/hover - (23)'. Params: { "textDocument": { "uri": "file:///home/user/lab/demo/playbook_syntx_highlighting.yml" }, "position": { "line": 18, "character": 17 } }

[Trace - 9:06:00 AM] Received response 'textDocument/hover - (23)' in 3ms. No result returned.

[Trace - 9:06:01 AM] Sending request 'textDocument/hover - (24)'. Params: { "textDocument": { "uri": "file:///home/user/lab/demo/playbook_syntx_highlighting.yml" }, "position": { "line": 19, "character": 17 } }

[Trace - 9:06:01 AM] Received response 'textDocument/hover - (24)' in 9ms. Result: { "contents": { "kind": "markdown", "value": "Send an email\n\nDescription\n\n- This module is useful for sending emails from playbooks\.\n- One may wonder why automate sending emails\? In complex environments there are from time to time processes that cannot be automated\, either because you lack the authority to make it so\, or because not everyone agrees to a common approach\.\n- If you cannot automate a specific step\, but the step is non\-blocking\, sending out an email to the responsible party to make them perform their part of the bargain is an elegant way to put the responsibility in someone else\'s lap\.\n- Of course sending out a mail can be equally useful as a way to notify one or more people in a team that a specific action has been \(successfully\) taken\." }, "range": { "start": { "line": 19, "character": 6 }, "end": { "line": 19, "character": 28 } } }

[Trace - 9:06:02 AM] Sending request 'textDocument/hover - (25)'. Params: { "textDocument": { "uri": "file:///home/user/lab/demo/playbook_syntx_highlighting.yml" }, "position": { "line": 19, "character": 18 } }

[Trace - 9:06:02 AM] Received response 'textDocument/hover - (25)' in 9ms. Result: { "contents": { "kind": "markdown", "value": "Send an email\n\nDescription\n\n- This module is useful for sending emails from playbooks\.\n- One may wonder why automate sending emails\? In complex environments there are from time to time processes that cannot be automated\, either because you lack the authority to make it so\, or because not everyone agrees to a common approach\.\n- If you cannot automate a specific step\, but the step is non\-blocking\, sending out an email to the responsible party to make them perform their part of the bargain is an elegant way to put the responsibility in someone else\'s lap\.\n- Of course sending out a mail can be equally useful as a way to notify one or more people in a team that a specific action has been \(successfully\) taken\." }, "range": { "start": { "line": 19, "character": 6 }, "end": { "line": 19, "character": 28 } } }

raoulaime avatar Jun 18 '25 13:06 raoulaime

It might have something to do with those two collections are using the powershell modules instead of python.

Nova38 avatar Aug 23 '25 06:08 Nova38