Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add hint for verify playbook #3222

Merged
merged 4 commits into from
Sep 2, 2021
Merged

docs: add hint for verify playbook #3222

merged 4 commits into from
Sep 2, 2021

Conversation

ltalirz
Copy link
Contributor

@ltalirz ltalirz commented Aug 31, 2021

As discussed in #3045, if the verify.yml playbook does not run the tested role, the library and module_utils provided by the tested role are not available there [1].

Usually, one does not want to re-run the role in the verify.yml playbook since it was already run twice before during the converge and idempotence stages, but testing the configuration of the server may well involve some of the modules provided by the role.
One workaround suggested by @tadeboro is to add an empty task list to the role and then to restrict tasks of the role to this file when including it in the verify.yml playbook.
This PR adds a note regarding this to the docs.

[1] The library actually is currently available, but this is an oversight; the module_utils are not available.

PR Type

  • Docs Pull Request

As discussed in ansible#3045, since the `verify.yml` playbook does not run the tested role, the `library` and `module_utils` provided by the tested role are not be available there [1].

Usually, one does not want to re-run the role in the `verify.yml` playbook since it was already run twice before.
One workaround suggested by @tadeboro is to add an empty task list to the role and then to restrict tasks of the role to this file when including it in the `verify.yml` playbook.
This PR adds a note regarding this to the docs.

[1]  (the `library` actually *is* currently available, but [this is an oversight](ansible#3045 (comment)); the `module_utils` are not available.
docs/getting-started.rst Outdated Show resolved Hide resolved
@ssbarnea ssbarnea added the bug label Aug 31, 2021
Copy link
Member

@ssbarnea ssbarnea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok to add this even if it is something module developers should already know. In fact it will soon become even more problematic as molecule will stop altering ansible include paths.

While I do think some people would be upset and say testing worked before and now is no longer working, we will say that our goal is to test how this code will run on production. On production we do not expect mounting random folder just to help ansible report an error. Being more strict and will less magic will help molecule provide better testing, like detecting things that are not installed correctly.

@ssbarnea
Copy link
Member

Also please fix reported issues.


.. note::

If the `verify.yml` playbook does not explicitly `include_role` your role, the `library` and `module_utils`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RST required double backquotes, single ones render as italic instead. See https://molecule--3222.org.readthedocs.build/en/3222/getting-started.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks - yeah, I tried it with the "Edit on Github" feature but in the end writing clean RST that way isn't all too easy...

I now installed the pre-commit hooks locally and built the docs; the issues should be fixed.

@ssbarnea ssbarnea merged commit b621839 into ansible:main Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants