Hi, I'm trying the simplest possible example of a Dynamic Inventory <http://docs.ansible.com/developing_inventory.html> but it won't work: my hosts.py file gets interpreted as a .ini file:
$ ansible-playbook -i *hosts.py* play.yml ERROR: *Invalid ini entry*: sys - need more than 1 value to unpack Here is the dynamic inventory *hosts.py*: import sys import json if len(sys.argv) == 2 and (sys.argv[1] == '--list'): inventory={} inventory['local'] = [ '127.0.0.1' ] print json.dumps(inventory, indent=4) elif len(sys.argv) == 3 and (sys.argv[1] == '--host'): print '{}' else: print "Usage: %s --list or --host <hostname>" % sys.argv[0] sys.exit(1) I'm pretty sure that it returns what it should. It's a much simpler example of the one shown there <http://jpmens.net/2013/06/18/adapting-inventory-for-ansible/>. And the playbook *play.yml* could not be simpler: - hosts: all connection: local tasks: - name: Can I run this playbook? debug: msg="Yes!" The playbook works when I run it playbook locally with this command: $ ansible-playbook -i 127.0.0.1, play.yml [output not copied here - it's all fine] I am stuck there. *What am I doing wrong* with my dynamic inventory? How can I get it to be evaluated as a python file, rather than a .ini file? -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/a27c75a7-74e4-468a-897c-c38489f21f5d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.