Skip to content

Commit

Permalink
nginx::resource::config define which adds arbitrary configs to conf.d
Browse files Browse the repository at this point in the history
  • Loading branch information
Udo Waechter committed Aug 14, 2013
1 parent 204fc54 commit 05ec889
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions manifests/resource/config.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
define nginx::resource::config ($ensure = 'present', $config) {
include nginx::params
validate_hash($config)

file { "${nginx::params::nx_conf_dir}/conf.d/${name}.conf":
content => template('nginx/conf.d/config.erb'),
ensure => $ensure,
notify => Service['nginx'],
}
}
4 changes: 4 additions & 0 deletions templates/conf.d/config.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### PUPPET MANAGED ###
<% @config.each_pair do |key,value| -%>
<%= key %> <%= value %>;

This comment has been minimized.

Copy link
@jfryman

jfryman Aug 22, 2013

Contributor

So, something I've been fighting with when using this pattern.... when to wrap value in quotes or not. Otherwise you end up with some ugly hash patterns that may be double-quoted (e.g.: '"variable"'). Any thoughts here?

<% end -%>

1 comment on commit 05ec889

@jfryman
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THIS SO MUCH!!!!

Please sign in to comment.