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

RFE: add option(s) to ansible-playbook to check modules are found and what content source they come from #68989

Closed
kdelee opened this issue Apr 16, 2020 · 5 comments
Labels
affects_2.10 This issue/PR affects Ansible v2.10 bot_closed feature This issue/PR relates to a feature request. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@kdelee
Copy link
Member

kdelee commented Apr 16, 2020

SUMMARY

There is a need to provide tooling for the following use cases:

  1. I have a playbook and I want to check to see what modules I am using are not in ansible-base, rather now they live in collections. I want to know what collection they live in without having to manually search through routing.yml. I prefer not to know routing.yml exists. I want to know which ones these are without having to run the playbook and see where it breaks, following including roles and include_tasks.

  2. I have a playbook and have installed in my environment a bunch of collections, I want to check and see what collection is going providing each module before running the playbook.

These address both users that are taking advantage of "tombstoning" as well as those who would like to update their content to explicitly use certain collections.

It provides a more sane way of developing and linting ansible content without having to take the approach of "just run it and see where blows up, then run it again and see where it blows up the next time" which is not a great development experience.

Currently, in order to figure out what collections my playbooks depend on, I either need to read ever task of every playbook and role and know intimately what has been moved (e.g. have routing.yml memorized) or run it and let it blow up, then manually look up what collection it is now hosted in by looking at https://github.com/ansible/ansible/blob/devel/lib/ansible/config/routing.yml .

#67684 is putting place "tombstoning" aims to enable people to not have to re-write their playbooks to be able to run with ansible 2.10, given that a collection is installed that provides the content that ansible knows to try based on https://github.com/ansible/ansible/blob/devel/lib/ansible/config/routing.yml

If indeed we are capable of doing such routing, then we should be capable of reporting to the user what that routing is without having to actually execute the playbook tasks.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

collections
routing.yml

ADDITIONAL INFORMATION

This feature would allow me to:

  1. Take inventory of what I need collections I need to install in order to run my existing playbooks with 2.10, simply taking advantage of tombstoning
  2. If I want to write new content or update current content to specify FQCN, it tells me what I need to do
  3. Once I have my playbooks the way I like and my collections installed in an environment, it allows me to double check that I am using the content from the desired collections. Would be extra great if it told me what version of that collection I am using, but that's a stretch goal. At least tell me what you are using. This is especially important if we are taking advantage of "flatmapping" aka tombstoning and there is some room for interpretation from the user about what collection might take precedence for providing a module.

Could look something like this:

Most basic, just show my modules mapped out w/ FQCN, have it behave like --list-tasks when it finds all some source for each module and show the source, have it fail like --syntax-check when it fails.

# happy path
ansible-playbook --content-check myplaybook.yml

playbook: ./myplaybook.yml

  play #1 (local):
    community.general.ini_file name='hello_ini_file' path=what second=example option=favorite value=color
    ansible.base.template src=mytemplate.j2 dest=foo.txt
# unhappy path (no source found for module)
ansible-playbook --content-check myplaybook.yml

playbook: ./myplaybook.yml

ERROR! Module "ini_file" not available but provided by community.general.ini_file.

If you intended to use "community.general.ini_file" make sure the "community.general" collection is installed and available in your ANSIBLE_COLLECTIONS_PATHS

The error appears to be in '/home/elijah/sfw/ansible/myplaybook.yml': line 5, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending task appears to be:

  tasks:
    - name: Update setting in an ini_file.
      ini_file: 

Alternatively, we might not need --content-check at all and all of the functionality could be rolled into --list-tasks and --syntax-check

@bcoca bcoca added feature This issue/PR relates to a feature request. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. waiting_on_contributor This would be accepted but there are no plans to actively work on it. and removed needs_triage Needs a first human triage before being processed. labels Apr 23, 2020
@ansibot
Copy link
Contributor

ansibot commented Apr 24, 2020

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added the affects_2.10 This issue/PR affects Ansible v2.10 label Apr 24, 2020
@AlanCoding
Copy link
Member

Same as #69334?

self-promotional plug: https://github.com/AlanCoding/ansible-locate

@ansibot
Copy link
Contributor

ansibot commented May 31, 2020

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Dec 25, 2020

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Apr 11, 2022

Thank you very much for your submission to Ansible. It means a lot to us that you've taken time to contribute.

Unfortunately, this issue has been open for some time while waiting for a contributor to take it up but there does not seem to have been anyone that did so. So we are going to close this issue to clear up the queues and make it easier for contributors to browse possible implementation targets.

However, we're absolutely always up for discussion. Because this project is very active, we're unlikely to see comments made on closed tickets and we lock them after some time. If you or anyone else has any further questions, please let us know by using any of the communication methods listed in the page below:

In the future, sometimes starting a discussion on the development list prior to proposing or implementing a feature can make getting things included a little easier, but it's not always necessary.

Thank you once again for this and your interest in Ansible!

click here for bot help

@ansibot ansibot added bot_closed and removed waiting_on_contributor This would be accepted but there are no plans to actively work on it. labels Apr 11, 2022
@ansibot ansibot closed this as completed Apr 11, 2022
@ansible ansible locked and limited conversation to collaborators Apr 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.10 This issue/PR affects Ansible v2.10 bot_closed feature This issue/PR relates to a feature request. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

No branches or pull requests

4 participants