Op dinsdag 27 oktober 2020 om 20:01:15 UTC+1 schreef [email protected]:

> 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 
>
>
Well great! This was the exact problem. After substituting %{%Y with %{{'{%'}}Y 
it worked !!

To still answer your first question; yes I am indeed using Jeff Geerling's 
Apache role. 

Many thanks for the help !! 
 

>
>
> 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/b4624a18-3376-4999-83a6-0361a326ce38n%40googlegroups.com.

Reply via email to