2016-11-15 71 views
0

我試圖替換包含一個反斜槓誤差ansible反斜線取代

- name: Replace test 
     replace: dest=/tmp/test 
     regexp="test" 
     replace="test, \" 

我得到ansible以下錯誤的字符串的模式:

The error appears to have been in '/home/deployer/ansible/roles/test/tasks/configuration.yml': line 11, column 3, but may 
be elsewhere in the file depending on the exact syntax problem. 

The offending line appears to be: 


- name: Replace test 
^here 

回答

1

儘管事實上,您我們省略了以字ERROR!開頭的實際錯誤消息,下面是解決您的問題的方法:

- name: Replace test 
    replace: 
    dest: /tmp/test 
    regexp: test 
    replace: 'test, \\' 
  • 心中的壓痕
  • 複雜的字符串操作(不 param=value簡寫)在
  • 逃生斜線
  • 使用字典風格的語法正則表達式替換表達