I want to use the raw module to run a 'sed' command which will contain escape characters.
- name: Search for prefix in file and replace all following text with addition
raw: "sed 's/\({{ prefix }}\)\(.*\)/\1 {{ addition }}/g' {{ file }} > {{ file }}.test"
This, however complains with:
ERROR! Syntax Error while loading YAML.
found unknown escape character
With the '^' pointing at the first '\' in the string. How to I include escape characters in this command without ansible trying to process them?
Best Answer
The task below works
with variables
gives
Modified regex from "^" till "$"
gives
Notes