Run Ansible playbook without inventory

Prerequisites. You need to have ssh server running on the host (ssh localhost should let you in).

Then if you want to use password authentication (do note the trailing comma):

$ ansible-playbook playbook.yml -i localhost, -k

In this case you also need sshpass.

In case of public key authentication:

$ ansible-playbook playbook.yml -i localhost,

And the test playbook, to get you started:

- hosts: all
  tasks:
    - debug: msg=test

You need to have a comma in the localhost, option argument, because otherwise it would be treated as a path to an inventory. The inventory plugin responsible for parsing the value can be found here.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)