# Ansible task failing on error " VARIABLE NOT DEFINED"

**URL:** <https://forum.ansible.com/t/ansible-task-failing-on-error-variable-not-defined/26945>\
**Category:** Ansible Project\
**Tags:** rhel\
**Created:** [March 9, 2018, 4:55pm UTC](https://forum.ansible.com/t/ansible-task-failing-on-error-variable-not-defined/26945 "2018-03-09T16:55:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zulkifal\_Sahibzada](https://avatars.discourse-cdn.com/v4/letter/z/898d66/32.png) [@Zulkifal\_Sahibzada](https://forum.ansible.com/u/Zulkifal_Sahibzada)\
**Post date:** [March 9, 2018, 4:55pm UTC](https://forum.ansible.com/t/ansible-task-failing-on-error-variable-not-defined/26945/1 "2018-03-09T16:55:47Z")

</div>

Hi list, I am new to this Ansible world. I am using a playbook from sandersv32/cis rhel-7-ansible section-5.2.2 which is giving me an error "VARIABLE NOT DEFINED’. Here is the task I am running

-name: 5.2.2 Enable auditd Service (Scored)

shell: systemctl is-enabled auditd.service

register: section5\_2\_2

-debug var=section5\_2\_2.stdout

ignore\_errors: True

tags:

- scored

- section5.2

- section5.2.2

- name: 5.2.2 Enable auditd Service (Scored)

service: \>

name=auditd

enabled=yes

state=running

when: “‘enabled’ not in section5\_2\_2.stdout”

tags:

- scored

- section5.2

- section5.2.2

This is the result, if I can get some help resolving this , will appreciate it

[![](https://lh3.googleusercontent.com/-kbkSvrV98Wk/WqK8bEA-V3I/AAAAAAAAGJ0/LXRQ0VK-pYgzz4pQvNBEKbXEl6Zr8t8QgCLcBGAs/s1600/variable.JPG)](https://lh3.googleusercontent.com/-kbkSvrV98Wk/WqK8bEA-V3I/AAAAAAAAGJ0/LXRQ0VK-pYgzz4pQvNBEKbXEl6Zr8t8QgCLcBGAs/s1600/variable.JPG)

Sincerely

ZS
