Show all services target host

Hi,

In localhost, i can write next command in prompt :

ansible localhost -m service -a “name=nginx state=started”

But how show all services in target host exemple :

ansible target_host -m service -a all

it’s not work.

Someone have a idea please ??

thanks very much guy !!

Hi,

What do you want to achieve ?
There is a module since ansible 2.5 version for what you want :

https://docs.ansible.com/ansible/latest/modules/service_facts_module.html

Regards,

JYL

Ok but,

ansible_facts.services is not defined when i use it and I display it on the screen.
Why ?

It works... use it correctly

Ansible ad-hoc use :

ansible -m service_facts -i my_ip_address, my_ip_address

For playbook there's a sample in the help...

If you want some help, please provide a command line or a playbook to request help.

Regards,

Hi,

exactly, answer is the next command:

ansible my_host -m service_facts -i my_ip_adress

Thank you very much Jean-Yves LENHOF !! :wink:

you are the best

subject solved !!