Why does gather_facts use the old IP address?

I am using Ansible 2.5.3 to build Debian servers on the linode.com web hosting service. When I provision a server with one Ansible playbook and then try to configure that server with a second Ansible playbook, that second playbook will use an old IP address from a previous run of these provision and configuration playbooks. In other words, if I run both playbooks one time and they run correctly but I destroy that server and re-run both playbooks, I’ll get the error shown below when the second configuration playbook runs it’s Gather Facts task:

TASK [Gathering Facts] ****
fatal: [my.example.com]: UNREACHABLE! => {“changed”: false, “msg”: "SSH Error: data could not be sent to the remote host . Make sure this host can be reached over ssh…

Here is my master playbook ‘site.yml’:


  • import_playbook: provision.yml
  • import_playbook: configure.yml

provision.yml looks like this:

Not Ansible per se, but SSH since it uses the feature Control Persist.

Try meta module[1] reset connection to see if that resolve your problem.

[1] https://docs.ansible.com/ansible/latest/modules/meta_module.html