AWS provisioning with empty inventory

I have problems to provision AWS when I have not at last one instance
online like this:

# ./playbooks/inventory/ec2.py --list
{
  "_meta": {
    "hostvars": {}
  }
}

and when I try to run ansible-playbook I receive

ERROR: provided hosts list is empty

If I go to AWS Console and lounch just one instance, the
ansible-playbook runs without problem and it provision all the other
required instances.

I have followed this tutorial:
http://docs.ansible.com/ansible/guide_aws.html
and also the chapter of Amazon EC2 of Lorin Hochstein book.

I also set these environment variables:
export AWS_ACCESS_KEY_ID='AKI...5YDA'
export AWS_SECRET_ACCESS_KEY='ndqL.....UT0st6'
export ANSIBLE_CONFIG=/etc/ansible/ansible.cfg
export ANSIBLE_HOSTS=/etc/ansible/playbooks/inventory/ec2.py
export EC2_INI_PATH=/etc/ansible/playbooks/inventory/ec2.ini

I also tryed with a hosts file like this:
[defaults]
remote_user = ubuntu
hostfile = ./playbooks/inventory/ec2.py
host_key_checking = False

[ssh_connection]
pipelining = True

but ansible refuses to start provisioning with an empty EC2 inventory.

Can you please explain me how solve the ERROR ?

Regards,

- --
Rodolfo Pilas
@pilasguru
http://pilas.guru
gpg: 2048R/23B5BE7B FCE6 6FC5 849D A0F6 E30D D1FC A33C 4E64 23B5 BE7B

What version of ansible? This implies that it was fixed: https://github.com/ansible/ansible/issues/9712 though possibly in a later version than what you’re executing.

Thank you Scott, this was the problem:

Previous version:

~# ansible --version
ansible 1.7.2

Upgraded and working like..... ansibleeeEE !

~# ansible --version
ansible 2.0.0
  configured module search path = /usr/share/ansible

# ansible-playbook site.yml
[WARNING]: provided hosts list is empty, only localhost is available

[DEPRECATION WARNING]: ec2_ami_search is kept for backwards
compatibility but
usage is discouraged. The module documentation details page may
explain more
about this rationale.. This feature will be removed in a future release.
Deprecation warnings can be disabled by setting
deprecation_warnings=False in
ansible.cfg.

[DEPRECATION WARNING]: ec2_ami_search is kept for backwards
compatibility but
usage is discouraged. The module documentation details page may
explain more
about this rationale.. This feature will be removed in a future release.
Deprecation warnings can be disabled by setting
deprecation_warnings=False in
ansible.cfg.

PLAY [Create .....

- --
Rodolfo Pilas
@pilasguru
http://pilas.guru
gpg: 2048R/23B5BE7B FCE6 6FC5 849D A0F6 E30D D1FC A33C 4E64 23B5 BE7B