Ansible retry task. retry file, you could do the following in ansible.