# lineinfile error "NameError: global name 'is\_quoted' is not defined"

**URL:** <https://forum.ansible.com/t/lineinfile-error-nameerror-global-name-is-quoted-is-not-defined/18083>\
**Category:** Ansible Project\
**Created:** [April 24, 2015, 10:23pm UTC](https://forum.ansible.com/t/lineinfile-error-nameerror-global-name-is-quoted-is-not-defined/18083 "2015-04-24T22:23:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sergey](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@sergey](https://forum.ansible.com/u/sergey)\
**Post date:** [April 24, 2015, 10:23pm UTC](https://forum.ansible.com/t/lineinfile-error-nameerror-global-name-is-quoted-is-not-defined/18083/1 "2015-04-24T22:23:29Z")

</div>

When using lineinfile, I get this kind of an error:

TASK: [Enable/Disable watchdog] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
failed: [dni-7448-35] =\> {“failed”: true, “parsed”: false}  
invalid output was: Traceback (most recent call last):  
File “/home/cumulus/.ansible/tmp/ansible-tmp-1429913951.55-31782322592167/lineinfile”, line 1917, in   
main()  
File “/home/cumulus/.ansible/tmp/ansible-tmp-1429913951.55-31782322592167/lineinfile”, line 370, in main  
should\_unquote = not is\_quoted(line)  
NameError: global name ‘is\_quoted’ is not defined

FATAL: all hosts have already failed – aborting

the task looks like so:

- name: Enable/Disable watchdog  
lineinfile: dest=/etc/watchdog.d/platform line=“run\_watchdog={{ run\_watchdog }}” state=present  
when: run\_watchdog is defined

Ansible version is 1.7

Anybody knows how to fix this?

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [April 27, 2015, 1:36am UTC](https://forum.ansible.com/t/lineinfile-error-nameerror-global-name-is-quoted-is-not-defined/18083/2 "2015-04-27T01:36:21Z")

</div>

Looking at the code in the git repo it looks like it’s fixed as of 1.7.1

The lineinfile module needs to have

from ansible.module\_utils.splitter import \*

Near the bottom of the file.

-Toshio
