Colon embedded in a quoted string

I’ve not tried the lineinfile module, however, you may need to quote the WHOLE value you pass in, i.e.:

action: ‘lineinfile destfile=/etc/sudoers regexp=“^nagios” value=“nagios ALL=NOPASSWD: ALL” state=“present” insertafter=“EOF”’

That error indicates that the YAML parser’s trying to read part of that line as a mapping and then barfing because it’s in the middle of what looks like a string value.