<% %> in template files

I have a line I need to add to my rsyslog.conf.erb template, but chef
doesn’t seem to like it because it contains the characters <% and %> and
there’s not any ruby between them.

For example, I added this line to my template (it needs to be added to the
rsyslog.conf on all my nodes):

$template GRAYLOG2,"<%PRI%>1 %timegenerated:::date-rfc3339% %HOSTNAME%
%syslogtag% - %APP-NAME%: %msg:::drop-last-lf%\n"

but chef seems to be getting confused by <%PRI%>

What do people suggest to work around this? Is there some way I can escape
those characters in a template or tell chef to treat them literally and not
as a ruby command or variable marker?

Charles J. Burns
charlesburns@gmail.com

Hey Charles,

You might try this:

On Tue, Oct 16, 2012 at 1:27 PM, Charles Burns charlesburns@gmail.com wrote:

I have a line I need to add to my rsyslog.conf.erb template, but chef
doesn't seem to like it because it contains the characters <% and %> and
there's not any ruby between them.

For example, I added this line to my template (it needs to be added to the
rsyslog.conf on all my nodes):

$template GRAYLOG2,"<%PRI%>1 %timegenerated:::date-rfc3339% %HOSTNAME%
%syslogtag% - %APP-NAME%: %msg:::drop-last-lf%\n"

but chef seems to be getting confused by <%PRI%>

What do people suggest to work around this? Is there some way I can escape
those characters in a template or tell chef to treat them literally and not
as a ruby command or variable marker?

--

Charles J. Burns
charlesburns@gmail.com

--
Kevin Karwaski
Operations Engineer @ {Fiksu}

Awesome, will give that a shot, thanks!

On Tue, Oct 16, 2012 at 1:30 PM, Kevin Karwaski kkarwaski@fiksu.com wrote:

Hey Charles,

You might try this:

ruby on rails - How do I escape the ERB tag in ERB - Stack Overflow

On Tue, Oct 16, 2012 at 1:27 PM, Charles Burns charlesburns@gmail.com
wrote:

I have a line I need to add to my rsyslog.conf.erb template, but chef
doesn't seem to like it because it contains the characters <% and %> and
there's not any ruby between them.

For example, I added this line to my template (it needs to be added to
the
rsyslog.conf on all my nodes):

$template GRAYLOG2,"<%PRI%>1 %timegenerated:::date-rfc3339% %HOSTNAME%
%syslogtag% - %APP-NAME%: %msg:::drop-last-lf%\n"

but chef seems to be getting confused by <%PRI%>

What do people suggest to work around this? Is there some way I can
escape
those characters in a template or tell chef to treat them literally and
not
as a ruby command or variable marker?

--

Charles J. Burns
charlesburns@gmail.com

--
Kevin Karwaski
Operations Engineer @ {Fiksu}

--

Charles J. Burns
charlesburns@gmail.com

That worked perfectly. <%%PRI%> in the template renders <%PRI%> in the
chef-generated file.

Thanks again!

On Tue, Oct 16, 2012 at 1:32 PM, Charles Burns charlesburns@gmail.comwrote:

Awesome, will give that a shot, thanks!

On Tue, Oct 16, 2012 at 1:30 PM, Kevin Karwaski kkarwaski@fiksu.comwrote:

Hey Charles,

You might try this:

ruby on rails - How do I escape the ERB tag in ERB - Stack Overflow

On Tue, Oct 16, 2012 at 1:27 PM, Charles Burns charlesburns@gmail.com
wrote:

I have a line I need to add to my rsyslog.conf.erb template, but chef
doesn't seem to like it because it contains the characters <% and %> and
there's not any ruby between them.

For example, I added this line to my template (it needs to be added to
the
rsyslog.conf on all my nodes):

$template GRAYLOG2,"<%PRI%>1 %timegenerated:::date-rfc3339% %HOSTNAME%
%syslogtag% - %APP-NAME%: %msg:::drop-last-lf%\n"

but chef seems to be getting confused by <%PRI%>

What do people suggest to work around this? Is there some way I can
escape
those characters in a template or tell chef to treat them literally and
not
as a ruby command or variable marker?

--

Charles J. Burns
charlesburns@gmail.com

--
Kevin Karwaski
Operations Engineer @ {Fiksu}

--

Charles J. Burns
charlesburns@gmail.com

--

Charles J. Burns
charlesburns@gmail.com