June 2020
Intermediate to advanced
410 pages
9h 52m
English
It is important to note that when we talk about running a playbook locally with Ansible, it is not the same as talking about running it on localhost. If we run a playbook on localhost, Ansible actually sets up an SSH connection to localhost (it doesn't differentiate its behavior or attempt to detect whether a host in the inventory is local or remote—it simply tries faithfully to connect).
Indeed, we can try creating a local inventory file with the following contents:
[local]localhost
Now, if we attempt to run the ping module in an ad hoc command against this inventory, we see the following:
$ ansible -i localhosts -m ping all --ask-passThe authenticity of host 'localhost (::1)' can't be established.ECDSA key fingerprint ...