# Show all services target host

**URL:** <https://forum.ansible.com/t/show-all-services-target-host/29647>\
**Category:** Ansible Project\
**Created:** [February 11, 2019, 1:22pm UTC](https://forum.ansible.com/t/show-all-services-target-host/29647 "2019-02-11T13:22:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryad9200000](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@ryad9200000](https://forum.ansible.com/u/ryad9200000)\
**Post date:** [February 11, 2019, 1:22pm UTC](https://forum.ansible.com/t/show-all-services-target-host/29647/1 "2019-02-11T13:22:41Z")

</div>

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 !!

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [February 11, 2019, 1:27pm UTC](https://forum.ansible.com/t/show-all-services-target-host/29647/2 "2019-02-11T13:27:06Z")

</div>

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](https://docs.ansible.com/ansible/latest/modules/service_facts_module.html)

Regards,

JYL

---

<div class="post-metadata">

**Author:** ![ryad9200000](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@ryad9200000](https://forum.ansible.com/u/ryad9200000)\
**Post date:** [February 11, 2019, 1:48pm UTC](https://forum.ansible.com/t/show-all-services-target-host/29647/3 "2019-02-11T13:48:29Z")

</div>

Ok but,

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

```

```auto
Why ?

```

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [February 11, 2019, 3:16pm UTC](https://forum.ansible.com/t/show-all-services-target-host/29647/4 "2019-02-11T15:16:25Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![ryad9200000](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@ryad9200000](https://forum.ansible.com/u/ryad9200000)\
**Post date:** [February 11, 2019, 4:26pm UTC](https://forum.ansible.com/t/show-all-services-target-host/29647/5 "2019-02-11T16:26:46Z")

</div>

Hi,

exactly, answer is the next command:

**ansible my\_host -m service\_facts -i my\_ip\_adress**

Thank you very much Jean-Yves LENHOF !! 😉

you are the best

subject solved !!
