How to manage auditd using ansible ?

Solution Verified - Updated -

Issue

  • How to reload/restart/stop auditd using ansible?
  • Reloading auditd.service using service module of ansible fails with following error :
$ cat test.yml 
---
- name: Testing Service Module
  hosts: test
  tasks:
   - name: Reload Auditd
     service:
        name: auditd
        state: reloaded

$ ansible-playbook test.yml
<snip>
TASK [Reload Auditd] ***********************************************************************************
fatal: [10.10.96.13]: FAILED! => {"changed": false, "msg": "Unable to reload service auditd: Failed to reload auditd.service: Job type reload is not applicable for unit auditd.service.\nSee system logs and 'systemctl status auditd.service' for details.\n"}
<snip>

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • ansible
  • auditd

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content