Ansible:如何通过 Ansible 获取服务状态? [英] Ansible: How to get service status by Ansible?
本文介绍了Ansible:如何通过 Ansible 获取服务状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过 Ansible 获取类似 redis-server
运行状态的服务.
I want to get service like redis-server
running status by Ansible.
我知道如何使用 Ansible 服务模块来停止或启动系统服务.但是我怎样才能获得当前的服务状态?
I know how to use Ansible service module to stop or start system service. But how can I get the current service status?
推荐答案
使用 command
模块和 service redis-server status
并解析 stdout.
或者使用 patched 服务模块.
Use command
module with service redis-server status
and parse stdout.
Or use patched service module.
这篇关于Ansible:如何通过 Ansible 获取服务状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文