If you use ansible templates to generate your config, and strong passwords, chances are that you know to use urlencode:
{ "postgres": "postgres://{{ db_user }}:{{ db_password|urlencode() }}@{{ db_server }}/{{ db_name }}", }
to ensure that any special chars are not mangled. Unfortunately, as I discovered to my cost, the jinja filter does NOT encode a forward slash as %2F.
To work around this (the jinja filter not encoding a forward slash as %2F), you may add regex_replace to the jinja filter chain.
Like this:
“postgres://{{ db_user }}:{{ db_password|urlencode()|regex_replace(‘/’,’%2F’) }}@{{ db_server }}/{{ db_name }}”
https://github.com/pallets/jinja/issues/515#issuecomment-378700788
good tip!