Ansible\'s lineinfile
gives a syntax error when there\'s a space after colon(:) in the line, like line=\'item: value\'
. If there\'s no space like <
I got another suggestion at Ansible's github issue, which is actually suggested in the error message...
lineinfile: "dest=/etc/sudoers line='%testgroup ALL= NOPASSWD: /sbin/shutdown -r now' state=present insertafter=EOF validate='visudo -cf %s'"
And also, aonther thing that's worth sharing is that I was suggested to stop by one of the two mailing lists, as appropriate: