Choose host (localhost) without inventory file

Hi,

Is it possible to specify host to run playbook without creating hosts configuration file?

Thanks.

Technically yes, but it’s really not encouraged, as you can’t take advantage of group or host variables easily, or even name groups.

You can -i “hostname.example.com,hostname2.example.com

In the case of specifying more than one host, it’s -i “hostname.example.com,” … you just have to end in a trailing comma.