You are using a playbook against localhost with an SSH connection (default in Ansible), and that fails. Most likely, because you never set up an account on your computer to accept the key from yourself. Using the default values, you need to add ~/.ssh/id_rsa.pub to ~/.ssh/authorized_keys .
Instead, to run locally, add connection: local to the game:
--- - hosts: localhost connection: local tasks: - debug:
And he will give you the correct answer:
TASK [debug] ******************************************************************* ok: [localhost] => { "msg": "Hello world!" }
source share