# Elasticsearch restart task hangs up in Ansible Playbook

**URL:** <https://discuss.elastic.co/t/elasticsearch-restart-task-hangs-up-in-ansible-playbook/19708>\
**Category:** Elasticsearch\
**Created:** [September 10, 2014, 10:22am UTC](https://discuss.elastic.co/t/elasticsearch-restart-task-hangs-up-in-ansible-playbook/19708 "2014-09-10T10:22:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![roopednra](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@roopednra](https://discuss.elastic.co/u/roopednra)\
**Post date:** [September 10, 2014, 10:22am UTC](https://discuss.elastic.co/t/elasticsearch-restart-task-hangs-up-in-ansible-playbook/19708/1 "2014-09-10T10:22:50Z")

</div>

I am using ansible playbook to install elasticsearch and elasticsearch  
plugin. after successfully installation of Elasticsearch I written one  
ansible task to Restart Elasticsearch. Its restarting elasticsearch but  
ansible playbook hang up in this task. My ansible task is:

```
- name: "Ensure Elasticsearch is Running"
  service: name=elasticsearch state=restarted

```

I also tried with `shell: sudo service elasticsearch restart` but no luck.

**Elasticsearch Version** : 1.3.0  
**Ansible Version** : 1.5.5

Verbose Output for the task is :

```
<app101.host.com> ESTABLISH CONNECTION FOR USER: prod on PORT 22 TO 

```

[app101.host.com](http://app101.host.com)  
\<[app101.host.com](http://app101.host.com)\> REMOTE\_MODULE service name=elasticsearch  
state=restarted  
\<[app101.host.com](http://app101.host.com)\> EXEC /bin/sh -c 'mkdir -p  
$HOME/.ansible/tmp/ansible-tmp-1410327554.04-167734794521310  
&& chmod a+rx  
$HOME/.ansible/tmp/ansible-tmp-1410327554.04-167734794521310 && echo  
$HOME/.ansible/tmp/ansible-tmp-1410327554.04-167734794521310'  
\<[app101.host.com](http://app101.host.com)\> PUT /tmp/tmpjIMUkF TO  
/home/prod/.ansible/tmp/ansible-tmp-1410327554.04-167734794521310/service  
\<[app101.host.com](http://app101.host.com)\> EXEC /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via  
ansible, key=yeztwzmmsgyvjjqmmunnvtbopcplrbso]  
password: " -u root /bin/sh -c '"'"'echo  
SUDO-SUCCESS-yeztwzmmsgyvjjqmmunnvtbopcplrbso; /usr/bin/python  
/home/prod/.ansible/tmp/ansible-tmp-1410327554.04-167734794521310/service;  
rm -rf  
/home/prod/.ansible/tmp/ansible-tmp-1410327554.04-167734794521310/

> /dev/null 2\>&1'"'"''

Any Suggestion?

While Starting Elasticsearch It show log on shell in earlier version it was  
just show [OK]. Does this cause any problem in ansible playbook?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6674a460-7cf5-4b97-b2b2-70671493420b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6674a460-7cf5-4b97-b2b2-70671493420b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![roopednra](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@roopednra](https://discuss.elastic.co/u/roopednra)\
**Post date:** [September 12, 2014, 5:40am UTC](https://discuss.elastic.co/t/elasticsearch-restart-task-hangs-up-in-ansible-playbook/19708/2 "2014-09-12T05:40:24Z")

</div>

Fix this problem. Cause of the issue. I am using old version of service  
wrapper script for elasticsearch. After update \* /etc/init.d/elasticsearch\*  
everything is working fine.

On Wednesday, 10 September 2014 15:52:50 UTC+5:30, Roopendra Vishwakarma  
wrote:

> I am using ansible playbook to install elasticsearch and elasticsearch  
> plugin. after successfully installation of Elasticsearch I written one  
> ansible task to Restart Elasticsearch. Its restarting elasticsearch but  
> ansible playbook hang up in this task. My ansible task is:
> 
> ```
> - name: "Ensure Elasticsearch is Running"
> service: name=elasticsearch state=restarted
> 
> ```
> 
> I also tried with `shell: sudo service elasticsearch restart` but no luck.
> 
> **Elasticsearch Version** : 1.3.0  
> **Ansible Version** : 1.5.5
> 
> Verbose Output for the task is :
> 
> ```
> <app101.host.com> ESTABLISH CONNECTION FOR USER: prod on PORT 22 TO 
> 
> ```
> 
> [app101.host.com](http://app101.host.com)  
> \<[app101.host.com](http://app101.host.com)\> REMOTE\_MODULE service name=elasticsearch  
> state=restarted  
> \<[app101.host.com](http://app101.host.com)\> EXEC /bin/sh -c 'mkdir -p  
> $HOME/.ansible/tmp/ansible-tmp-1410327554.04-167734794521310  
> && chmod a+rx  
> $HOME/.ansible/tmp/ansible-tmp-1410327554.04-167734794521310 && echo  
> $HOME/.ansible/tmp/ansible-tmp-1410327554.04-167734794521310'  
> \<[app101.host.com](http://app101.host.com)\> PUT /tmp/tmpjIMUkF TO  
> /home/prod/.ansible/tmp/ansible-tmp-1410327554.04-167734794521310/service  
> \<[app101.host.com](http://app101.host.com)\> EXEC /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo  
> via ansible, key=yeztwzmmsgyvjjqmmunnvtbopcplrbso]  
> password: " -u root /bin/sh -c '"'"'echo  
> SUDO-SUCCESS-yeztwzmmsgyvjjqmmunnvtbopcplrbso; /usr/bin/python  
> /home/prod/.ansible/tmp/ansible-tmp-1410327554.04-167734794521310/service;  
> rm -rf  
> /home/prod/.ansible/tmp/ansible-tmp-1410327554.04-167734794521310/
> 
> > /dev/null 2\>&1'"'"''
> 
> Any Suggestion?
> 
> While Starting Elasticsearch It show log on shell in earlier version it  
> was just show [OK]. Does this cause any problem in ansible playbook?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/75daf5e9-2407-415e-a152-169a02017987%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/75daf5e9-2407-415e-a152-169a02017987%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:02am UTC](https://discuss.elastic.co/t/elasticsearch-restart-task-hangs-up-in-ansible-playbook/19708/3 "2017-07-06T01:02:54Z")

</div>


