I have an erb template
in a chef cookbook
that configures my vhost
for my vagrant
environment and my aws opsworks
environment. I would like to utilize this template on my continuous integration server to generate the vhost for my non chef managed machines before it pushes it out.
Suppose I have the following erb:
<VirtualHost <%= @params[:http_host] %>:<%= @params[:http_port] || node['apache']['listen_ports'].first %>>
ServerName <%= @params[:server_name] %>
ServerAlias <% @params[:server_aliases].each do |a| %><%= a %> <% end %>
DocumentRoot <%= @params[:docroot] %>
</VirtualHost>
How do I go about populating those variables if I wanted to call erb
directly?
I know I can call erb -r library vhost.conf.erb
to load a library to be leveraged, can set variables as an argument to erb or do I need to create a custom library. If I need a custom library, how would that look?