It looks to me as though 127.0.0.1 unreachable!

I’ve written quite a few Ansible roles now and feel like I have a good grasp of what’s going on, but recently I’ve come across a strange response to my attempt to run a local shell command. Here’s my complete {{ role }}/tasks/main.yaml:

`

It seems replacing 127.0.0.1 with localhost resolves the issue.

​do you have a host in your inventory defined as 127.0.0.1? this would override the ‘implicit’ localhost which sets ansible_connection=local.​