Skip to content

Include modules under library/ in documentation #1147

Open
@lukasjuhrich

Description

@lukasjuhrich

Problem

Not clear whether bug or feature request.

Repro

  • Create a module in library/my_module.py
  • Create a playbook playbook.yml using this module in a task
  • Hover over the module name

expectation

  • The docs should appear.

reality

  • The docs do not appear.

Notes

I think this should be supported because the entrypoint in the ansible documentation, „Creating a module“, specifically asks you to put your module code in the library/ folder.

So clearly this is a module location that is not only implicitly supported by ansible-playbook recognizing it, but explicitly supported in the sense that the documentation teaches you to use this location.

However, note that modules created this way differ from

  • collection modules
  • builtin modules
    by the fact that they (to my knowledge) don't have an FQCN.

I don't even know what the correct name for such modules is, but I guess there is none – ansible does not seem to provide any reference documentation on this topic.

(Nota bene: even ansible-doc does not care about these modules either unless you set library=./library in the ansible.cfg, which is a bug in ansible-doc I guess)

Solution

Adapt this code to support discovering „local“(?) modules and search for files in library/*.py (or however you want to name them) modules.
https://github.com/ansible/ansible-language-server/blob/47f78bb7c2356d5542561c1dfea4c63e7e1b15b5/src/utils/docsFinder.ts#L24-L46

Alternatives

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions