Don't believe you can from systemctl commands, but just like we create service definitions, we can delete them as well. I'm thinking:
1. Stop the service, and disable 2. Track down the service definition file, delete it 3. Perform a systemctl daemon-reload... might have to do this as a command. But, why delete? DIsable is not good enough? *Kosala* On Wed, May 31, 2023 at 12:04 PM Narmada Karthika <[email protected]> wrote: > it has.. > > coming to my other question, can I delete a service on linux using > ansible.. > > On Tuesday, May 30, 2023 at 4:10:03 PM UTC-7 Kosala Atapattu wrote: > >> Just wonder whether the user you initially ran on had sudo access... >> >> >> *Kosala* >> >> >> >> >> On Wed, May 31, 2023 at 10:26 AM Narmada Karthika <[email protected]> >> wrote: >> >>> Right, I had it in the task level, some how it did not work. >>> >>> On Tuesday, May 30, 2023 at 3:24:38 PM UTC-7 "Kosala Atapattu (කෝසල >>> අතපත්තු)" wrote: >>> >>>> >>>> >>>> Sent from my iPhone >>>> >>>> On 31/05/2023, at 10:20 AM, Narmada Karthika <[email protected]> >>>> wrote: >>>> >>>> yea, I tried that option just to check if its timing out before it is >>>> disabling >>>> >>>> btw, I got it fixed I changed the user: root at the top level instead >>>> of play level >>>> >>>> >>>> Aha, you can also opt to become root in task level, with sudo as well. >>>> >>>> >>>> >>>> On Tuesday, May 30, 2023 at 3:13:40 PM UTC-7 "Kosala Atapattu (කෝසල >>>> අතපත්තු)" wrote: >>>> >>>>> Just wonder whether you can disable that service manually in 5 mins? >>>>> >>>>> Sent from my iPhone >>>>> >>>>> On 31/05/2023, at 10:07 AM, Narmada Karthika <[email protected]> >>>>> wrote: >>>>> >>>>> I am trying to run my playbook to check/restart/stop kestrel service >>>>> on given node. I am able to ping that node using ansible but when running >>>>> the task its is failing with connection timeout error. >>>>> >>>>> here is the playbook >>>>> --- >>>>> - name: check kestrel service >>>>> hosts: lin_dev >>>>> become: true >>>>> gather_facts: no >>>>> vars: >>>>> kestrelservicename: kestrel-api.service >>>>> >>>>> tasks: >>>>> - name: check status of kestrel service >>>>> ansible.builtin.service: >>>>> name: "{{ kestrelservicename }}" >>>>> state: started >>>>> enabled: no >>>>> become_user: root >>>>> timeout: 300 >>>>> >>>>> >>>>> >>>>> >>>>> error is >>>>> >>>>> "ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, >>>>> "changed": false, "msg": "Unable to disable service kestrel-api.service: >>>>> Failed to execute operation: Connection timed out\n"} >>>>> >>>>> -- >>>>> 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/3aed1068-3bbe-4426-b98a-fc9b2818cdadn%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/ansible-project/3aed1068-3bbe-4426-b98a-fc9b2818cdadn%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/cb497d46-3084-42ec-ba57-bc8fbb58a614n%40googlegroups.com >>>> <https://groups.google.com/d/msgid/ansible-project/cb497d46-3084-42ec-ba57-bc8fbb58a614n%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/7cb16a2e-1422-450a-87c7-0fe1351ada88n%40googlegroups.com >>> <https://groups.google.com/d/msgid/ansible-project/7cb16a2e-1422-450a-87c7-0fe1351ada88n%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/711feae7-75dc-430d-b65f-90480970024cn%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/711feae7-75dc-430d-b65f-90480970024cn%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/CAP7S5Hbin9YmxJtOrj2fAz6Wv0PN_ZRrmPafne8eeUFZqMVfJw%40mail.gmail.com.
