Help with Playbook

20 views
Skip to first unread message

Luiz Guilherme Nunes Fernandes

unread,
Apr 27, 2021, 9:27:28 AM4/27/21
to Ansible Project
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?

Stephen Maher

unread,
Apr 27, 2021, 9:38:24 AM4/27/21
to ansible...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/04ea3a7f-f081-4c5e-b37e-edd514c8a357n%40googlegroups.com.

Komal Suthar

unread,
Apr 27, 2021, 10:15:48 AM4/27/21
to ansible...@googlegroups.com
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.

Reply all
Reply to author
Forward
0 new messages