Search code examples
ansible

Ansible: How to get service status by Ansible?


I want to get the service status, such as redis-server by Ansible.

I know how to use Ansible service module to stop or start system service.
But how can I get the current service status?


Solution

  • Use command module with service redis-server status and parse stdout.
    Or use patched service module.