Hi, Check out service_facts module:
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_facts_module.html Regards Steve Maher > On 27 Apr 2021, at 14:27, Luiz Guilherme Nunes Fernandes > <[email protected]> wrote: > > 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? > > -- > 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 [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/04ea3a7f-f081-4c5e-b37e-edd514c8a357n%40googlegroups.com > > <https://groups.google.com/d/msgid/ansible-project/04ea3a7f-f081-4c5e-b37e-edd514c8a357n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/463B69FB-196D-4CDD-BAB8-DB9CA382F12C%40gmail.com.
