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

Inventory does not meet host_list/script requirements (Ansible 2.7.1) #48859

Closed
mil1i opened this issue Nov 18, 2018 · 45 comments
Closed

Inventory does not meet host_list/script requirements (Ansible 2.7.1) #48859

mil1i opened this issue Nov 18, 2018 · 45 comments
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. module This issue/PR relates to a module. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@mil1i
Copy link

mil1i commented Nov 18, 2018

SUMMARY

After upgrading to ansible version 2.7.1 using Homebrew on macOS, I receive the following informational warning when running playbooks with the verbose option.

/etc/ansible/hosts did not meet host_list requirements, check plugin documentation if this is unexpected
/etc/ansible/hosts did not meet script requirements, check plugin documentation if this is unexpected

My playbooks still run and complete without issue. I have never had any issues with my hosts file in the past, nor does this message display with ansible 2.7.0.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

host_list plugin (inventory file)
script plugin (inventory file)

ANSIBLE VERSION
ansible 2.7.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/Users/myuser/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.7.1/libexec/lib/python3.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.7.1 (default, Nov  6 2018, 18:45:35) [Clang 10.0.0 (clang-1000.11.45.5)]
CONFIGURATION
ANSIBLE_PIPELINING(/etc/ansible/ansible.cfg) = True
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/etc/ansible/hosts']
DEFAULT_REMOTE_USER(/etc/ansible/ansible.cfg) = myuser
RETRY_FILES_ENABLED(/etc/ansible/ansible.cfg) = False
OS / ENVIRONMENT

macOS High Sierra 10.13.6

STEPS TO REPRODUCE

Switch to ansible version 2.7.1, run any playbook with verbose enabled.

ansible-playbook test.yml -v
EXPECTED RESULTS
Using /etc/ansible/ansible.cfg as config file
PLAY [localhost] *************************************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************************
ok: [localhost]
ACTUAL RESULTS

Playbooks still run and complete without issue. But ansible's verbose informational message suggests something is wrong with my inventory file with the latest version available (on Homebrew).

Using /etc/ansible/ansible.cfg as config file
/etc/ansible/hosts did not meet host_list requirements, check plugin documentation if this is unexpected
/etc/ansible/hosts did not meet script requirements, check plugin documentation if this is unexpected
PLAY [localhost] *************************************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************************
ok: [localhost]
@ansibot
Copy link
Contributor

ansibot commented Nov 18, 2018

Hi @mil1i, thank you for submitting this issue!

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Nov 18, 2018

Files identified in the description:

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

click here for bot help

@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Nov 18, 2018
@sivel
Copy link
Member

sivel commented Nov 19, 2018

This was purposefully implemented in #46766 to provide additional information when running ansible with -v or higher.

If you have further questions please stop by IRC or the mailing list:

@sivel sivel closed this as completed Nov 19, 2018
@sivel sivel removed the needs_triage Needs a first human triage before being processed. label Nov 19, 2018
@alanbbr
Copy link

alanbbr commented Nov 19, 2018

IMO, it's not additional information. If it said why requirements weren't met, or even just had a link to what the new requirements are, it might be useful.

@bcoca
Copy link
Member

bcoca commented Nov 19, 2018

no new requirements, its just giving you info on WHY a plugin was skipped, there are many reasons, in this case it is because it didn't pass the 'verify' phase for the plugin, which should have the specific requirements in it's own documentation (see ansible-doc -t inventory )

@alanbbr
Copy link

alanbbr commented Nov 19, 2018

I see nothing in the message that says WHY, just WHAT, and that it does poorly. ansible-doc -t inventory ini doesn't give me any hint whatsoever as to what might not verify. If the verify phase has a complaint, it should be specific about it (line, column, what is not correct), not a vague message that doesn't mean anything if you don't live in the Ansible source code.

@bcoca
Copy link
Member

bcoca commented Nov 19, 2018

The WHY is that requirements were not met, a parsing error can be another reason and that will give a specific exception/tracekback. Each plugin has it's own requirements and verification, in many cases it does not have to do with file contents but nature of the file itself.

Using -vvv you should see at least one of the reasons for requirements not being met:
Skipping due to inventory source not existing or not being readable by the current user

@alanbbr
Copy link

alanbbr commented Nov 19, 2018

-vvv shows nothing more than the -v message. Neither does -vvvvvv. Looks to me like a bug for an alert to a non-existent issue, at least for ini based inventories.

@bcoca
Copy link
Member

bcoca commented Nov 19, 2018

I gave that as one example, there are other reasons, not all of them show the specific info, it depends on the specific plugins. The ini inventory is not causing this, directly, you are seeing it because 2 other plugins get 'checked' before the ini accepts the file.

@alanbbr
Copy link

alanbbr commented Nov 19, 2018

Whatever those plugins that get checked are doing needs to be reported. Just saying something isn't right but giving absolutely no clue as to what is wrong, is wrong. Either the "did not meet requirements" message is showing up for no reason and should be removed, or give a real reason that says WHAT, WHERE, and WHY.

@bcoca
Copy link
Member

bcoca commented Nov 19, 2018

its an incremental improvement, that part of the code doesn't know the reason, just that the plugin rejected it in verification phase, it is more info than you got before, in which you didnt know that it was rejected in that phase

@alanbbr
Copy link

alanbbr commented Nov 19, 2018

Since everything runs for both myself the original poster, it doesn't look like an improvement.

@mkesper
Copy link

mkesper commented Nov 20, 2018

Very confusing, indeed.

@sgrade
Copy link

sgrade commented Nov 21, 2018

I also found this message confusing.

@jan-harmsen
Copy link

I agree that his "error" message is not helpful, at least there should be a link to the specific chapter in documentation containing host_list requirements. My playbooks run without problems and I have no clue why exactly this message occurs and how to fix the problem.

@mkesper
Copy link

mkesper commented Nov 22, 2018

its an incremental improvement, that part of the code doesn't know the reason, just that the plugin rejected it in verification phase, it is more info than you got before, in which you didnt know that it was rejected in that phase

So maybe those plugins should better trigger a message (or not) as they possess any useful info?

@leedm777
Copy link
Contributor

I agree that the message is confusing. I had no idea what "host_list requirements" are, or what plugin it was talking about.

After reading the Inventory Plugins docs, I did figure out a workaround. If you configure Ansible with just the inventory plugin you are using, you avoid warnings about files not meeting the requirements of the other plugins.

[inventory]

# avoid "did not meet _ requirements" warnings when using -v
# see https://github.com/ansible/ansible/issues/48859
enable_plugins = ini

bcoca added a commit to bcoca/ansible that referenced this issue Nov 23, 2018
  Plugins should also add more info on higher verbosity levels see ansible#48859
martignoni added a commit to moodlebox/moodlebox that referenced this issue Nov 24, 2018
@C0missar
Copy link

How do you know WHICH plugin generated the message? That at least would be a hint. I reduced my plugin list down to one (yaml), and still get the message, but the inventory seems to be parsed fine.

@bcoca
Copy link
Member

bcoca commented Nov 27, 2018

the message has always had the plugin name, host_list/ini/script/yaml/etc , the new one now puts it at the start of the message instead of the middle.

@alanbantuit
Copy link

No it doesn't. It has the file being complained about at the start, not the name of the plugin doing the complaining.

/Users/alan/Source/ansible_home/hosts.ini did not meet host_list requirements, check plugin documentation if this is unexpected

I see nothing that looks like a plugin name. As @leedm777 suggested, limiting the inventory enabled plugin to just ini eliminates the message, so even the hint of the file name is not correct.

Given that enable_plugins = ini stops the message, it looks to me like some other inventory plugin is incorrectly getting the ini file as input, and complaining about it, with an inadequate error message. How is this not a bug?

@bcoca
Copy link
Member

bcoca commented Nov 28, 2018

@alanbantuit read the new message from the PR above, that is the one that puts the plugin at the start

As from your example 'host_list' is the plugin, which i agree is not clear, which is why i changed it to be at the start of it.

@BarbzYHOOL
Copy link

BarbzYHOOL commented Dec 1, 2018

So what do bros? What is plugin "host_list"??

I added

[inventory]
enable_plugins = host_list, script, yaml, ini, auto

to my conf but same message

@xoffey
Copy link

xoffey commented Dec 2, 2018

This seems to be one type of bug that doesn't look like a bug to the author but that obviously causes problems for ordinary users. Maybe the wording should be clearer that it is not an error, and the plugin name should be in quotes, as in

INFO somefile.inv does not meet the requirements of the "host_list" plugin

@bcoca
Copy link
Member

bcoca commented Dec 3, 2018

The text has already changed, #49080, also i bumped up at the verbosity it shows at.

To clarify this is NOT a warning nor an error, just an informational message that appears when using the verbosity setting. None of the messages on increased verbosity are errors, those are always displayed, you might get more information about an error but errors and warnings have their own display facilities.

@BarbzYHOOL
Copy link

hmm true, warnings are in purple and errors in red

i still don't know what the message is about though :D

@kmcgrego1307
Copy link

It seems to me that if some code is emitting informational messages about inputs not passing a test, other code that tests the same input should emit an informational message about that input passing its test. That would be consistent and more informative. Here it looks like the input passes some test somewhere, but we don't know where.

@bcoca
Copy link
Member

bcoca commented Dec 6, 2018

when the test passes you see the plugin 'processing' the input, this message was meant to give some information on why plugins didn't attempt to do so

@cricketer
Copy link

Funny that this issue is the first that pops up after searching for the error messages stated in the description. Because that is what I had to do to find a solution after comparing my inventory list with the documentation examples finding no oddities.

I have respect for the Ansible team and I'm grateful for their work, but this is not a cool change @bcoca it's confusing and unnecessary because it leaves us with questions rather than answers.

If Ansible have a problem with my input files, I want it to go hard exit, tell me exactly what the problem is so I can fix it and go on with the task.

@bcoca
Copy link
Member

bcoca commented Dec 10, 2018

the way inventory plugins work is that we have a list of them, given a source we go through the list and see if that source matches the plugin and then if it can be parsed, you will get a warning (toggle to make it an error) if no plugin is able to read a file.

i.e given an hosts.ini, first we try 'host_list' (which takes inline host string -i "host1, host2,"), then script (for dynamic scripts) , then yaml and then ini (if this was skipped, then 'auto'). I added the message to make clear why a plugin skipped the source, in this case, that it didn't pass the 'verify' phase, PR above makes this message clearer.

Again, this was never an error or warning, it was one more of the many messages you get when running verbose.

@flatrocks
Copy link

Now that I have read this discussion, I understand what these messages are about. But it's worth noting that I spent maybe 20 minutes researching and reading this (and comments indicate that it was a concern for many more users.) If every message in verbose output was so worrisome to cause this sort of response, no one would ever get anything useful done with Ansible and/or the verbose mode would be considered useless.

The problem for me was that using "-v" or "-vv" reports the plugins that did NOT work, but does NOT indicate which one DID work. You have to go full "-vvv" to see which plugin worked. Maybe just making the plugin success message always display at the same verbose level as the plugin failure messages would avoid this confusion.

@bcoca
Copy link
Member

bcoca commented Dec 19, 2018

@flatrocks again, look at PR above, it did just that

@ssbarnea
Copy link
Member

I have to say that I find the message confusing too, this being the reason why I ended up reading this bug.

This is more of a debugging level message which still prints on V=1 which is not ok. The irony is that these messages are printed but you have no idea which plugin was used to load the hosts file in the end, if it was loaded at all.

I think that the bug is genuine and underlines several issues:

  • message does mention correctly the plugin name, it should be something clear like 'FILE did not meet FOO inventory plugin requirements, skipped loading it.
  • It should be a message about succesfull load of the inventory file
  • Skipping load of an inventory file should be displayed only when greater verbosity is enabled lile V>=2 or so.
  • RTFD messages that do not include permalinks to docs, provide a bad user experience. If a message recommands user to read the docs, it must include an url.

@carlio
Copy link

carlio commented Dec 31, 2018

I am getting "Could not match supplied host pattern, ignoring: 'all'" after these messages so clearly something is not working somewhere but there is no information about how to find this or fix it. Definitely needs a better error message.

@deepakjoshishri
Copy link

Can we know what type of requirements that we need to match so that we do not get this info message?

@sremy
Copy link

sremy commented Jan 4, 2019

The new message in the fixing PR commit is:
display.vvv("%s declined parsing %s as it did not pass it's verify_file() method" % (plugin_name, source))

@bcoca
Shouldn't it be "its" instead of "it's"?
https://github.com/ansible/ansible/blob/devel/lib/ansible/inventory/manager.py#L281
By the way, thanks for this clarification.

@alanbbr
Copy link

alanbbr commented Jan 4, 2019 via email

@sgutermann
Copy link

Please someone tell me if after reading all of this I finally have it right in my head. There are several different plugins for reading the inventory (I use yaml).

All this thing is trying to tell me is that it did not pass the inventory check for the ini style, script, or whatever other one?

@linuxnut
Copy link

@sgutermann Yes, it's trying to tell you that it did not pass the inventory check for ini script (because it's using the yaml one instead.

If in the ansible.cfg you just used:

[inventory]
# enable inventory plugins, default: 'host_list', 'script', 'yaml', 'ini'
enable_plugins = yaml

Then those "informational notices" would go away. I agree that it's not clear what they are for, but after some trial and error, I was able to get rid of those "notices". I use the ini format for everything, and don't run "one offs" ...so I just using ini, and tada...no more irritating messages.

@micfan
Copy link

micfan commented Jan 18, 2019

what is this error, I am a newbie who want have a try of Ansible,

But it rasied a error, which I don't know how to resolve.....

akafred added a commit to akafred/dotfiles that referenced this issue Jan 23, 2019
.../dotfiles/.provisioning/hosts did not meet host_list requirements, check plugin documentation if this is unexpected
.../dotfiles/.provisioning/hosts did not meet script requirements, check plugin documentation if this is unexpected

see ansible/ansible#48859
@bradwood
Copy link

I also keep getting this, despite putting

enable_plugins = ini

in my ansible.cfg file. Super annoying...

@umeboshi2
Copy link

@bcoca , clarifying the message as @ssbarnea suggests would help immensely. The message in the PR is not quite as clear, and the suggestion would help prevent users from wanting to look under the hood to discover why something is being "declined" due to being "unverified," rather than being "skipped" for another inventory plugin. The message should also identify the plugin as an inventory plugin as suggested. Also, thanks for providing the info message in the first place, and setting the verbosity to match the level of the inventory plugin that's actually loaded. I did get to learn something today after wondering "what did I do wrong?" :)

umeboshi2 added a commit to umeboshi2/freelawmachine that referenced this issue Jan 25, 2019
@candlerb
Copy link
Contributor

With 2.7.8 I get this message:

Using /root/ansible/ansible.cfg as config file
/root/ansible/hosts did not meet host_list requirements, check plugin documentation if this is unexpected
/root/ansible/hosts did not meet script requirements, check plugin documentation if this is unexpected

For me it was not obvious that host_list and script were the actual names of plugins.

I think it would be clearer as:

Using /root/ansible/ansible.cfg as config file
/root/ansible/hosts did not meet requirements for "host_list" plugin, check plugin documentation if this is unexpected
/root/ansible/hosts did not meet requirements for "script" plugin, check plugin documentation if this is unexpected

@amal-mejri

This comment has been minimized.

@candlerb

This comment has been minimized.

@amal-mejri

This comment has been minimized.

@ansible ansible locked as off-topic and limited conversation to collaborators Apr 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. module This issue/PR relates to a module. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

No branches or pull requests