In my ansible-playbook, task realize problem replace in file text with characters. I'm using ansible module shell with sed.
i want realize problem
txt.file: Some text @@VAR_NUMBER_ONE@@
new txt.file: Some text {{VAR_NUMBER_ONE}}
- name: sed
shell: sed -i 's|@@\([a-zA-Z_ ]*\)@@|\{{\1}}|g' txt.file
I've got fatal error
fatal: [localhost]: FAILED! => { "msg": "An unhandled exception occurred while templating 's|@@\([a-zA-Z_ ]*\)@@|\{{\1}}|g'. Error was a , original message: unexpected char u'\\' at 25" }
sed -i 's|@@\([^@]*\)@@|{{\1}}|g' txt.file. Not sure, but you might need to double each backslash. - Wiktor Stribiżew