lineinfile error.

Hi --

There's a bug either in the YAML parser or the lineinfile module (or the
documentation), I'm not sure exactly what the problem is. This example
from the docs:

  - lineinfile: dest=/etc/sudoers state=present regexp='^%wheel'
  line='%wheel ALL=(ALL) NOPASSWD: ALL'

fails with:

ERROR: Syntax Error while loading YAML script,
/export/tools/ops/ansible/roles/common/tasks/main.yml
Note: The error may actually appear before this position: line 34,
column 95

The line 34, column 95 is the colon after NOPASSWD:

If this isn't a known issue, I'm happy to file a github issue. In the
meantime, any ideas for a workaround? Single quotes, loading the value
from a variable, and \: don't fix the problem. Interestingly (well, to
me), a colon in the regexp statement does not cause an error.

Thanks.
k.

quote everything from “dest … ALL’” , the : is a yaml special character and the whole module param string needs to be quoted.

Ah. There it is ... the quoting permutation I didn't try. Thanks a ton
for your help. It'd be great to see the bug in the documentation fixed.

k.

it is documented that ANY module, not just lineinfile needs to be careful with YAML characters. It is just appears more commonly in lineinfile cause of obvious reasons.