简体   繁体   English

使用Ansible启动jboss服务

[英]Start a jboss service with ansible

I wrote a simple ansible playbook to stop and start a jboss service, problem is on the server when I start the service manually it requires a password, but when I run the playbook it throws and error even though the password is provided. 我写了一个简单的ansible剧本来停止和启动jboss服务,问题出在服务器上,当我手动启动该服务时需要密码,但是当我运行剧本时,即使提供了密码,它也会抛出错误。

Here is the playbook. 这是剧本。

剧本

and this is the error I get when I ran it 这是我运行它时遇到的错误

PLAY [dev] *********************************************************************

TASK [setup] *******************************************************************
ok: [10.33.122.122]

TASK [Stop jboss server] *******************************************************
fatal: [10.33.122.122]: FAILED! => {"changed": false, "failed": true, "msg": "standard in must be a tty\n"}

NO MORE HOSTS LEFT *************************************************************
 [WARNING]: Could not create retry file 'main.retry'.         [Errno 2] No such file or directory: ''


PLAY RECAP *********************************************************************
10.33.122.122              : ok=1    changed=0    unreachable=0    failed=1   

And you can stop jboss service with jbosssvc user from CLI? 您可以从CLI停止使用jbosssvc用户的jboss服务吗?

Yes but it requires a password and i input it as required then it stops, how do I do the same on a playbook though? 是的,但是需要输入密码,我需要输入密码,然后密码才停止,但是我该如何在剧本上做同样的事情?

It means jbosssvc is not allowed to stop the service (which is somewhat expected situation), thus you cannot use become_user: jbosssvc directive. 这意味着不允许jbosssvc停止服务(这在某种程度上是预期的情况),因此您不能使用become_user: jbosssvc指令。

You must become root to perform this operation (and this requires connecting user to be able to run commands with elevated permissions). 您必须成为root才能执行此操作(并且这要求连接用户能够以提升的权限运行命令)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM