Ansible without an inventory file

This article was published 4 years ago. Due to the rapidly evolving world of technology, some concepts may no longer be applicable.

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

Thoughts on this post

Leave a comment?