2016-05-02 75 views
0

我在centos上創建了一個名爲cooltoo_storage的系統服務。通過運行命令「service cooltoo_storage start/stop/restart」,我可以啓動/停止/重新啓動服務。現在我想在完整的劇本中進行配置。以下是我啓動此服務的配置。無法使用劇本啓動系統服務

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

運行ansible-劇本後,我得到了以下錯誤

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狀態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. 

我應該怎麼解決這個問題?

回答

0

該問題與Ansible無關。

您的服務cooltoo_storage未能啓動。只要確保它的工作原理:

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

如果不是 - 修復它。可能cooltoo_storage自定義書面服務。從開始檢查出啓動配置爲這一特定服務調查:/etc/rc.d/init.d/cooltoo_storage

systemctl cat cooltoo_storage.service 

和內容