Ask Your Question
0

puppet manifest : f5 irule allowed chars

asked 2013-07-18 18:21:26 -0500

BaltoStar gravatar image

updated 2013-07-18 19:13:21 -0500

I am receiving a syntax error around use of html in an irule :

node f5_proxy {
  f5_rule { 'irule-01':
    ensure     => 'present',
    definition => 'when HTTP_REQUEST {
    ...
    <table width='100%'><tr><td align='center'>

puppet device barfs at parsing the single quote ( '100%' and 'center' ).

Where can I find docs covering how to include iRules in puppet manifest files *.pp ?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-07-18 22:39:55 -0500

When doing anything more than a one liner, I recommend using a template to supply the content for the 'definition'. Here is an example:

f5_rule { 'bounce_to_www':
  ensure     => present,
  definition => template('role/f5/bounce_to_www_irule.erb'),
}

An example template stored in the file .../modules/role/templates/f5/bouncetowww_irule.erb could look something like:

when HTTP_REQUEST {
  if { [HTTP::host] starts_with "<%= @domain %>" } {
    HTTP::redirect <a href="http://www.%3C%25=">http://www.<%=</a> @domain %>[HTTP::uri]
  }
}
edit flag offensive delete link more

Comments

Thanks Adam. Does the template() directive assume a relative-path starting-point, such as {module-name}/template/ ? Or should the path be relative to the manifest *.pp file ?

BaltoStar gravatar imageBaltoStar ( 2013-07-19 14:13:57 -0500 )edit

Template is a function that looks in '{modulename}/templates' to find the template. So I created a module called 'role' and I put the template into the 'templates' directory that ...(more)

Adam Crews gravatar imageAdam Crews ( 2013-07-19 14:38:58 -0500 )edit

ok but actually you have template('role/f5/bounce_to_www_irule.erb') -- is that a typo ? Seems possible to define *any* path relative to modulepath - if modulepath=/etc/puppet/modules , template('f5-config ...(more)

BaltoStar gravatar imageBaltoStar ( 2013-07-19 16:38:53 -0500 )edit

I'm sorry for the confusion. I created a module called 'role', in this module I create sub classes, like role::f5, role::webserver, ect... I put my template in ...(more)

Adam Crews gravatar imageAdam Crews ( 2013-07-19 19:25:11 -0500 )edit
1

answered 2013-07-18 19:35:07 -0500

GregLarkin gravatar image

updated 2013-07-18 19:36:39 -0500

I would try switching to double quotes or possibly omitting the quotes from the HTML attributes altogether.

You could also replace the single quotes in the HTML string with escaped single quotes, e.g. \'

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2013-07-18 18:21:26 -0500

Seen: 283 times

Last updated: Jul 18 '13