无法使用ansible-playbook

时间:2016-05-02 03:41:33

标签: ansible ansible-playbook

我在centos上创建了名为cooltoo_storage的系统服务。我可以通过运行命令“service cooltoo_storage start / stop / restart”来启动/停止/重启服务。现在我想在ansible playbook上配置它。以下是我启动此服务的配置。

- name: start cooltoo_storage service
  sudo: yes
  service:
  name: cooltoo_storage
  state: started

运行ansible-playbook后,我收到了以下错误

msg: Job for cooltoo_storage.service failed because the control process exited with error code. See "systemctl status cooltoo_storage.service" and "journalctl -xe" for details.


FATAL: all hosts have already failed -- aborting

以下是“systemctl status cooltoo_storage.service”的命令输出,

● cooltoo_storage.service - LSB: cooltoo storage provider
 Loaded: loaded (/etc/rc.d/init.d/cooltoo_storage)
 Active: failed (Result: exit-code) since Mon 2016-05-02 11:39:07 CST; 1min 5s ago
 Docs: man:systemd-sysv-generator(8)
Process: 26661 ExecStart=/etc/rc.d/init.d/cooltoo_storage start (code=exited, status=203/EXEC)

 May 02 11:39:07 Cool-Too systemd[1]: Starting LSB: cooltoo storage provider...
May 02 11:39:07 Cool-Too systemd[26661]: Failed at step EXEC spawning /etc/rc.d/init.d/cooltoo_storage: Exec format error
May 02 11:39:07 Cool-Too systemd[1]: cooltoo_storage.service: control process exited, code=exited status=203
May 02 11:39:07 Cool-Too systemd[1]: Failed to start LSB: cooltoo storage provider.
May 02 11:39:07 Cool-Too systemd[1]: Unit cooltoo_storage.service entered failed state.
May 02 11:39:07 Cool-Too systemd[1]: cooltoo_storage.service failed.

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

问题与Ansible无关。

您的服务cooltoo_storage无法启动。只要确保它有效:

sudo systemctl restart cooltoo_storage.service
sudo systemctl status cooltoo_storage.service

如果没有 - 修复它。可能cooltoo_storage自定义书面服务。从检查此特定服务的启动配置开始调查:

systemctl cat cooltoo_storage.service

和内容:/etc/rc.d/init.d/cooltoo_storage