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

Created on 18 Nov 2018  ·  45Comments  ·  Source: ansible/ansible



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]
affects_2.7 bug module python3 core

Most helpful comment

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.

All 45 comments

Hi @mil1i, thank you for submitting this issue!

click here for bot help

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

This was purposefully implemented in https://github.com/ansible/ansible/pull/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:

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.

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 )

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.

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

-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.

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.

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.

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

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

Very confusing, indeed.

I also found this message confusing.

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.

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?

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

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.

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.

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?

@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.

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

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

The text has already changed, https://github.com/ansible/ansible/pull/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.

hmm true, warnings are in purple and errors in red

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

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.

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

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.

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.

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.

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

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.

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.

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

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.

Yes, “it’s” is the contraction of “it is”, not the possessive of “it”. The possessive is “its”.

From: "sremy" notifications@github.com
To: "ansible/ansible" ansible@noreply.github.com
Cc: "Alan Brenner" alan@abcompcons.com, "Comment" comment@noreply.github.com
Sent: Friday, January 4, 2019 7:05:19 AM
Subject: Re: [ansible/ansible] Inventory does not meet host_list/script requirements (Ansible 2.7.1) (#48859)

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))

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


You are receiving this because you commented.
Reply to this email directly, [ https://github.com/ansible/ansible/issues/48859#issuecomment-451426545 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AAigO-Cbc5kdXQNhBL8mpkefzwoemKN9ks5u_0N_gaJpZM4YoJPK | mute the thread ] .

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?

@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.

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.....

I also keep getting this, despite putting

enable_plugins = ini

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

@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?" :)

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

@candlerb same issue !!

[root@localhost ~]_### ansible-playbook -i /etc/ansible/hosts openshift-ansible/playbooks/openshift-node/bootstrap.retry -vvv_
ansible-playbook 2.7.10
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.5 (default, Mar 26 2019, 22:13:06) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
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
Parsed /etc/ansible/hosts inventory source with ini plugin
ERROR! playbooks must be a list of plays

The error appears to have been in '/root/openshift-ansible/playbooks/openshift-node/bootstrap.retry': line 1, column 1, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

master.istic.linsoft.com

ERROR! playbooks must be a list of plays

That's a different problem. You are providing a retry file as if it were a YAML playbook, and it is not; it's a list of failed hosts.

Use: ansible-playbook /path/to/bootstrap.yml --limit @/path/to/bootstrap.retry

Since that is not a bug, please refrain from further discussion here - use the ansible-project google group instead.

Hey ! thank you for the quick responding
otherwise I still get the same issue
...

Le dim. 21 avr. 2019 à 08:54, Brian Candler notifications@github.com a
écrit :

ERROR! playbooks must be a list of plays

That's a different problem. You are providing a retry file as if it were a
YAML playbook, and it is not; it's a list of failed hosts.

Use: ansible-playbook /path/to/bootstrap.yml --limit
@/path/to/bootstrap.retry

Since that is not a bug, please refrain from further discussion here - use
the ansible-project google group instead.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/ansible/ansible/issues/48859#issuecomment-485232650,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALWB2BCFZ5OPUOJSKEXNP6TPRQMT7ANCNFSM4GFASPFA
.

Was this page helpful?
0 / 5 - 0 ratings