# How to recover from expected connection loss?

**URL:** <https://forum.ansible.com/t/how-to-recover-from-expected-connection-loss/27249>\
**Category:** Ansible Project\
**Created:** [April 11, 2018, 1:56pm UTC](https://forum.ansible.com/t/how-to-recover-from-expected-connection-loss/27249 "2018-04-11T13:56:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uwe\_Sauter](https://avatars.discourse-cdn.com/v4/letter/u/41988e/32.png) [@Uwe\_Sauter](https://forum.ansible.com/u/Uwe_Sauter)\
**Post date:** [April 11, 2018, 1:56pm UTC](https://forum.ansible.com/t/how-to-recover-from-expected-connection-loss/27249/1 "2018-04-11T13:56:25Z")

</div>

Hi all,

I'm trying to reduce the size of the locale archive on CentOS 7.4 as described in [1] and [2]. Ansible version is 2.4.2.0-2.el7

For this I have a script on the client, that calls the needed commands:

###### /root/bin/rebuild\_locale.sh  
#!/bin/bash

LOCALES="en\_US:de\_DE"

mv /usr/lib/locale/locale-archive /usr/lib/locale/locale-archive.tmpl  
build-locale-archive -l ${LOCALES}

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [April 14, 2018, 9:11am UTC](https://forum.ansible.com/t/how-to-recover-from-expected-connection-loss/27249/2 "2018-04-14T09:11:52Z")

</div>

You can use async on the task to fire and forget it.  
And in the next task have wait\_for to check when ssh is responding again.
