On Thu, 12 Nov 2020 15:13:37 -0800 (PST)
bill paxton <
epican.ansib...@gmail.com> wrote:
> I have a task that works fine for Ansible 2.9.7, but fails when I upgrade
> to 2.10.3.
> ...
> Data could not be sent to remote host "localhost". Make sure this host can
> be reached over ssh: ssh: connect to host localhost port 22: Cannot assign
> requested address
FWIW, I'm still on 2.9.6.
As a hint, try to find out why *ssh* connection plugin is used to
connect localhost. IMHO, the default is *local*. For example, testing
with no configuration of the connection ("cat hosts | grep
connection" shows nothing)
shell> cat pb.yml
- hosts: test_01
tasks:
- debug:
var: ansible_connection
- debug:
var: ansible_connection
delegate_to: localhost
gives
TASK [debug] ****
ok: [test_01] =>
ansible_connection: ssh
TASK [debug]****
ok: [test_01 -> localhost] =>
ansible_connection: local
See DEFAULT_TRANSPORT
https://docs.ansible.com/ansible/latest/reference_appendices/config.html#default-transport
"man ansible" says
-v, --verbose
verbose mode (-vvv for more, -vvvv to enable connection
debugging)
For example
shell> ansible-playbook pb.yml -vvvv | grep connection
connection: smart
ansible_connection: ssh
ansible_connection: local
--
Vladimir Botka