By the var name I guess you're using the jeff geerling's apache role?
I use that too and also ran into this issue.
You need to escape the jinja looking part.
My snippet:

apache_global_vhost_settings: |
  # Sortable log format, with federated username.
  LogFormat "%v:%p %{{'{%'}}F %T}t.%{msec_frac}t %h %u \"%r\" %>s %O
\"%{Referer}i\"\
    \"%{User-Agent}i\"" vhost_federated_combined



On Tue, 27 Oct 2020 at 19:21, Roy Lenferink <[email protected]> wrote:
>
> Hello everyone,
>
> I am having a problem with defining a string variable in Ansible (v2.9.9)
>
> The string I want to define (for the geerlingguy.apache role):
> apache_global_vhost_settings: |
>   LogFormat "<%%JSON:httpd_access%%> { \"time\": \"%\{%Y}t\" }" combined
>   CustomLog logs/access_log combined
>
> This doesn't work and I am getting the following error message:
> template error while templating string: Encountered unknown tag 'Y'.. String: 
> LogFormat  <snip>
>
> It basically comes down to the following part: \"%\{%Y}t\" }
>
> How can I achieve the specified string in Ansible ? I tried escaping several 
> properties however wasn't able to find out a solution.
>
> Best regards,
> Roy
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/2a810b8d-48a3-4157-b3ca-2048cd022de5n%40googlegroups.com.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwNGxRDqO1%2Bx3amNy0ax48wRhMj93aDN9bQj-EGYsMZjQQ%40mail.gmail.com.

Reply via email to