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

61 views
Skip to first unread message

Leo P

unread,
Jul 7, 2016, 1:08:10 PM7/7/16
to Ansible Project
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!

Kai Stian Olstad

unread,
Jul 7, 2016, 1:46:51 PM7/7/16
to ansible...@googlegroups.com
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"'

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages