lineinfile error "NameError: global name 'is_quoted' is not defined"

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?

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