I was wondering if there was any way to update the address that Ansible uses to ssh into a host mid-playbook.
I'm trying to write a script that will shutdown an AWS EC2 host, start a snapshot of the root volume, boot it back up, and perform some other tasks. The catch is that the address of this instance changes when it reboots and Ansible keeps using the address it retrieved at the beginning of the playbook via the dynamic inventory script, causing the rest of the actions to fail.
I've considered breaking the playbook into two different files so I can refresh the hosts cache after the box starts back up, but I'd prefer to execute all the tasks in one run. I've also tried looking around for some fact I could set to change the address Ansible uses to ssh, but I haven't found anything.
Is it possible to change the address Ansible is using to ssh from within the playbook? If it is, how can I change it?
Thanks for any and all help!