can't get embedded quotes to work in replace string of lineinfile

I have tried escaping characters but it didn’t seem to make any difference. According to the documentation I’ve seen, this should work:

`

  • name: Change keyboard layout to U.S.
    lineinfile: dest=/etc/default/keyboard
    regexp=‘XKBLAYOUT=“gb”’
    replace=‘XKBLAYOUT=“us”’

`

But I get this error:

`
TASK [Change keyboard layout to U.S.] ******************************************
fatal: [raspberrypi]: FAILED! => {“changed”: false, “failed”: true, “msg”: “unsupported parameter for module: replace”}

`

The ansible version is 2.1.0.0 running on fedora 23. What am I doing wrong?

Thanks!

Module lineinfile doesn't have replace parameter. I think you are trying to use the replace module.

- name: Change keyboard layout to U.S.
   replace:
     dest=/etc/default/keyboard
     regexp='XKBLAYOUT="gb"'
     replace='XKBLAYOUT="us"'