Elasticsearch重启任务在Ansible Playbook中挂起

时间:2014-09-09 10:20:59

标签: elasticsearch ansible ansible-playbook

我使用ansible playbook来安装elasticsearch和elasticsearch插件。在成功安装Elasticsearch之后,我写了一个ansible任务来重启Elasticsearch。它的重新启动弹性搜索但是ansible playbook挂起了这个任务。我的任务是:

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

我也试过shell: sudo service elasticsearch restart但没有运气。

Elasticsearch版本:1.3.0
Ansible Version :1.5.5

任务的详细输出为:

<app101.host.com> ESTABLISH CONNECTION FOR USER: prod on PORT 22 TO app101.host.com
<app101.host.com> REMOTE_MODULE service name=elasticsearch state=restarted
<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> PUT /tmp/tmpjIMUkF TO /home/prod/.ansible/tmp/ansible-tmp-1410327554.04-167734794521310/service
<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'"'"''

有没有人面临类似的问题?

2 个答案:

答案 0 :(得分:0)

尝试使用

- name: Restart elasticsearch service
  sudo: yes
  shell: "/etc/init.d/elasticsearch stop || true && /etc/init.d/elasticsearch start"

答案 1 :(得分:0)

解决此问题。问题的原因是我使用旧版本的服务包装脚本进行elasticsearch。更新后/etc/init.d/elasticsearch一切正常。