Connecting to localhost and 127.0.0.1

When trying to run a playbook without specifying -i “localhost,” -c local I get that the host is unreachable, even though I specify the localhost in my /etc/ansible/hosts file:

Is there something I’m missing in the hosts file? Here is the output from running just ansible-playbook helloworld.yml:

Can you ssh to localhost without a password?
Try: ssh localhost

If that works add -vvvv to the ansible command.
Also why do you want to use ssh to run stuff on your system?