Ansible执行命令

时间:2016-01-14 16:26:22

标签: shell hadoop ansible apache-zookeeper ansible-playbook

我已经使用ansible配置了一个完全分布式的hadoop集群,但我想配置ansible来执行下一个命令。

我使用next来执行zookeeper,但是我有下一个错误。

- name: ejecutar zkServer.sh
  become_user: vagrant
  shell: sh /opt/zookeeper-3.4.7/bin/zkServer.sh



TASK: [ejecutar | ejecutar zkServer.sh] *************************************** 
failed: [172.16.8.211] => {"changed": true, "cmd": "sh /opt/zookeeper-3.4.7/bin/zkServer.sh", "delta": "0:00:00.006246", "end": "2016-01-18 14:28:44.181146", "rc": 2, "start": "2016-01-18 14:28:44.174900", "warnings": []}
stderr: /opt/zookeeper-3.4.7/bin/zkServer.sh: 81: /opt/zookeeper-3.4.7/bin/zkEnv.sh: Syntax error: "(" unexpected (expecting "fi")

FATAL: all hosts have already failed -- aborting

感谢。

1 个答案:

答案 0 :(得分:0)

它与下一个命令一样工作:

- name: ejecutar zkServer.sh
  become_user: vagrant
  command: "/opt/zookeeper-3.4.7/bin/zkServer.sh restart"