Could you use the service module instead of command.
Handler:
- name: centos7 restart auditd
service:
name: audits
state: restarted
become: yes
Also wanted to know how do you run your playbook because you defined as
handler.
On Mon, Feb 17, 2020 at 8:36 AM Bala Mutyam <[email protected]> wrote:
> Hi all,
>
> Anisble Version: ansible 2.7.7
>
>
> I'm configuring auditd on centos7 but the auditd service is failing to
> restart.
>
> Handler:
>
> - name: centos7 restart auditd
> become: yes
> command: service auditd restart
>
> Error:
>
> FAILED! => {"changed": false, "msg": "Unable to restart service auditd:
> Failed to restart auditd.service: Operation refused, unit auditd.service
> may be requested by dependency only (it is configured to refuse manual
> start/stop).\nSee system logs and 'systemctl status auditd.service' for
> details.\n"}
>
> I can restart the service via commandline on the host using "service
> auditd restart"
>
> I'm running playbook as root user
>
> Could someone help me please?
>
> --
> 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/417abda6-bbfd-4af8-9eed-8ee023e5eb73%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/417abda6-bbfd-4af8-9eed-8ee023e5eb73%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
Sincerely,
Abdoul Alarou
Tel: 2406676734
Email: [email protected]
--
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/CACH1cPBiZ2cA_nfOZq_Ydoqu9shaVg60z9vogt-_AiwqgL3vEg%40mail.gmail.com.