# Help with Playbook

**URL:** <https://forum.ansible.com/t/help-with-playbook/35068>\
**Category:** Ansible Project\
**Created:** [April 27, 2021, 1:27pm UTC](https://forum.ansible.com/t/help-with-playbook/35068 "2021-04-27T13:27:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luiz\_Guilherme\_Nunes](https://avatars.discourse-cdn.com/v4/letter/l/90ced4/32.png) [@Luiz\_Guilherme\_Nunes](https://forum.ansible.com/u/Luiz_Guilherme_Nunes)\
**Post date:** [April 27, 2021, 1:27pm UTC](https://forum.ansible.com/t/help-with-playbook/35068/1 "2021-04-27T13:27:28Z")

</div>

Dears,  
I have a doubt, I new verify if exist a service on systemd with playbook.

My part code:

- name: Stop service puppet-agent  
service:  
name: puppet  
state: stopped  
enabled: no

How Can I verify if existe puppet-agent on systemd, if exists I need to disable service, if no, I would like to pass for next configuration. Any suggestion?

---

<div class="post-metadata">

**Author:** ![mahespth](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mahespth/32/252_2.png) [@mahespth](https://forum.ansible.com/u/mahespth)\
**Post date:** [April 27, 2021, 1:38pm UTC](https://forum.ansible.com/t/help-with-playbook/35068/2 "2021-04-27T13:38:10Z")

</div>

Hi,

Check out service\_facts module:

[https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service\_facts\_module.html](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_facts_module.html)

Regards

Steve Maher

---

<div class="post-metadata">

**Author:** ![Komal\_Suthar](https://avatars.discourse-cdn.com/v4/letter/k/919ad9/32.png) [@Komal\_Suthar](https://forum.ansible.com/u/Komal_Suthar)\
**Post date:** [April 27, 2021, 2:15pm UTC](https://forum.ansible.com/t/help-with-playbook/35068/3 "2021-04-27T14:15:22Z")

</div>

Or another approach is you can register the output using the register keyword and fetch, and use when condition to do further actions on the basis of that particular output.
