Reputation: 1921
When using the blockinfile module of ansible, if we use regex_replace filter the filters arguments have to changed in order to get it working. This is against the documentation of the filter. Is it that the escaping is done by the template engine?
https://github.com/ansible/ansible-modules-extras/issues/3105
Upvotes: 0
Views: 134
Reputation: 68269
It's generally a bad practice to ask questions with links to external site with essential information.
As for your problem, you use or don't use escaping depending on outer string quotes:
# don't escape
block: |
RewriteCond %{HTTP_HOST} ={{ url | regex_replace('(?:https?://)?([^/:]+)?.*', '\1') }}
# escape
block: "RewriteCond %{HTTP_HOST} ={{ url | regex_replace('(?:https?://)?([^/:]+)?.*', '\\1') }}"
Upvotes: 1