ANSIBLE_INVENTORY_ENABLED not picking up values

713 views
Skip to first unread message

senorsmile

unread,
Sep 19, 2017, 3:40:02 PM9/19/17
to Ansible Project
As specified here: 


we must now specify the inventory type, making yaml based inventory a higher precedence.  


I found the new cli env vars here:


I'm trying to override this via the env var to no avail: 

ANSIBLE_INVENTORY_ENABLED='script,yaml,ini' ansible web1 -i inventory/ -m raw -a uptime

If I put garbage in there, it shows that it's loading them though: 

ANSIBLE_INVENTORY_ENABLED='[a,i,o]' ansible web1 -i inventory/ -m raw -a uptime


 [WARNING]: Failed to load inventory plugin, skipping [a
 [WARNING]: Failed to load inventory plugin, skipping i
 [WARNING]: Failed to load inventory plugin, skipping o]

senorsmile

unread,
Sep 19, 2017, 4:03:12 PM9/19/17
to Ansible Project
The ansible.cfg doesn't seem to be working either. 

I added the following to ansible.cfg

enable_plugins = 'host_list', 'script', 'yaml'


and now I see these errors: 

ansible all -i inventory/ --list-hosts



 [WARNING]: Failed to load inventory plugin, skipping 'host_list'
 [WARNING]: Failed to load inventory plugin, skipping 'script'
 [WARNING]: Failed to load inventory plugin, skipping 'yaml'
ERROR! No inventory plugins available to generate inventory, make sure you have at least one whitelisted.

senorsmile

unread,
Sep 19, 2017, 4:06:03 PM9/19/17
to Ansible Project
The items should NOT have quotes around them. 

Now I get the same as setting the env var from the cli: 

 [WARNING]: Unable to parse
/Users/shaun_smiley/Seafile/scripts/ansible/yaml_inventory/inventory/backend/nodes.yml as an inventory source

Brian Coca

unread,
Sep 19, 2017, 5:10:03 PM9/19/17
to Ansible Project
could you run with -vvv and/or ANSIBLE_DEBUG=1?


----------
Brian Coca

senorsmile

unread,
Sep 19, 2017, 5:32:04 PM9/19/17
to Ansible Project
Running: 

ansible all -i inventory/backend/nodes.yml --list-hosts -vvv

ansible 2.4.0.0
  config file = /Users/shaun/Seafile/scripts/ansible/yaml_inventory/ansible.cfg
  configured module search path = ['/Users/shaun/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/shaun/Gentoo/usr/lib/python3.5/site-packages/ansible
  executable location = /Users/shaun/Gentoo/usr/lib/python-exec/python3.5/ansible
  python version = 3.5.2 (default, Sep  1 2017, 08:53:54) [GCC 4.2.1 Compatible Clang 3.9.1 (tags/RELEASE_391/final)]
Using /Users/shaun/Seafile/scripts/ansible/yaml_inventory/ansible.cfg as config file
 [WARNING]: Unable to parse
/Users/shaun/Seafile/scripts/ansible/yaml_inventory/inventory/backend/nodes.yml as an inventory source

 [WARNING]: No inventory was parsed, only implicit localhost is available

 [WARNING]: Could not match supplied host pattern, ignoring: all

 [WARNING]: provided hosts list is empty, only localhost is available

 [WARNING]: No hosts matched, nothing to do

  hosts (0):

That's interesting... it's using python3.5.  

I created a virtualenv for ansible 2.4 and everything works.  

It seems that my environment with a default python3.5 (technically a gentoo prefix on Mac) is actually using python3.  That doesn't happen in the gentoo prefix for Ansible 2.3.2.  

The virtualenv works though, so problem solved for me... not sure if there is in fact a larger issue here though. 
Reply all
Reply to author
Forward
0 new messages