Ansible without an inventory file

This is a nice little trick. If you’re working with a small number of servers (in my case, it was just one – my desktop), Ansible doesn’t actually require an inventory file. You can specify a comma-separated list of hosts on the command line (there has to be at least one comma, so the trailing comma in this example is important). In this case, I’m also using a local connection instead of SSH

ansible-playbook -c local -i 'localhost,' playbook/to/run.yml

Michael is a polyglot software engineer, committed to reducing complexity in systems and making them more predictable. Working with a variety of languages and tools, he shares his technical expertise to audiences all around the world at user groups and conferences. You can follow @mheap on Twitter

Thoughts on this post

Leave a comment?

Leave a Reply