Ask Your Question
0

Is Puppet Evaluating Variables in my YAML data?

asked 2016-01-07 21:24:42 -0500

Red Cricket gravatar image

I have this in a yaml file in my hiera data:

wsgi_keystone_conf_contents: |
 Listen 5000 
 Listen 35357

 <VirtualHost *:5000>
     WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
     WSGIProcessGroup keystone-public
     WSGIScriptAlias / /var/www/cgi-bin/keystone/main
     WSGIApplicationGroup %{GLOBAL}
     WSGIPassAuthorization On
     LogLevel info 
     ErrorLogFormat "%{cu}t %M"
     ErrorLog /var/log/httpd/keystone-error.log
     CustomLog /var/log/httpd/keystone-access.log combined
 </VirtualHost>

 <VirtualHost *:35357>
     WSGIDaemonProcess keystone-admin processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
     WSGIProcessGroup keystone-admin
     WSGIScriptAlias / /var/www/cgi-bin/keystone/admin
     WSGIApplicationGroup %{GLOBAL}
     WSGIPassAuthorization On
     LogLevel info 
     ErrorLogFormat "%{cu}t %M"
     ErrorLog /var/log/httpd/keystone-error.log
     CustomLog /var/log/httpd/keystone-access.log combined
 </VirtualHost>

And I try to create a my wsgi-keystone.conf file in my puppet manifest like so :

file { '/etc/httpd/conf.d/wsgi-keystone.conf':
    ensure   => present,
    content  => $wsgi_keystone_conf_contents,
}

But this results in a file that looks like this ...

Listen 5000
Listen 35357

<VirtualHost *:5000>
    WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone group=keystone display-name=
    WSGIProcessGroup keystone-public
    WSGIScriptAlias / /var/www/cgi-bin/keystone/main
    WSGIApplicationGroup
    WSGIPassAuthorization On
    LogLevel info
    ErrorLogFormat "t %M"
    ErrorLog /var/log/httpd/keystone-error.log
    CustomLog /var/log/httpd/keystone-access.log combined
</VirtualHost>

<VirtualHost *:35357>
    WSGIDaemonProcess keystone-admin processes=5 threads=1 user=keystone group=keystone display-name=
    WSGIProcessGroup keystone-admin
    WSGIScriptAlias / /var/www/cgi-bin/keystone/admin
    WSGIApplicationGroup
    WSGIPassAuthorization On
    LogLevel info
    ErrorLogFormat "t %M"
    ErrorLog /var/log/httpd/keystone-error.log
    CustomLog /var/log/httpd/keystone-access.log combined
</VirtualHost>

The above file has syntax error and httpd will not restart. How am I supposed to put data in my YAML file? Do I need to escape the %'s?

edit retag flag offensive close merge delete

Comments

My first though is that the curly braces in " %{cu} " are getting parsed as a variable by puppet/hiera and an empty one at that, so this is the result you get. Try escaping the special characters. Another option will be to use template files instead of storing everything in Hiera ;)

Kozzio gravatar imageKozzio ( 2016-01-08 05:10:34 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-01-11 10:02:57 -0500

Yeah, as Kozzio said, file data like this typically lives in templates, not in Hiera. Otherwise, have a look at this thread here.

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

1 follower

Stats

Asked: 2016-01-07 21:24:42 -0500

Seen: 146 times

Last updated: Jan 11 '16