How do I run Ansible without inventory? I want my playbook to provision a new Digital Ocean droplet and then write its details to a local inventory file. However every time I run my playbook with an empty hosts file it complains, stating “ERROR: provided hosts list is empty”
Am I trying to do something that isn’t possible with Ansible?
Thanks,
Matt
I would suggest you read:
http://www.ansibleworks.com/docs/guide_aws.html
if you want to avoid writing the initial localhost you can always pass -i ‘localhost,’ to the ansible command (trailing comma is intentional and needed).
Yeah the trailing comma is a hack, we should not suggest it in most cases.
Be that as it may, i’ve found this tip invaluable in quickly applying chosen roles to a few servers / test servers.