Skip to content

Commit

Permalink
Merge pull request voxpupuli#95 from ubc/hiera-support
Browse files Browse the repository at this point in the history
Add Hiera support
  • Loading branch information
James Fryman committed Jul 21, 2013
2 parents ad6aea2 + 40a174f commit e1b0f83
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
27 changes: 27 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,30 @@ Add an smtp proxy
}
}
</pre>

# Hiera Support
Define the nginx resources in Hiera. Here are the examples:

<pre>
nginx::nginx_upstreams:
'puppet_rack_app':
ensure: present
members:
- localhost:3000
- localhost:3001
- localhost:3002
nginx::nginx_vhosts:
'www.puppetlabs.com':
www_root: '/var/www/www.puppetlabs.com'
'rack.puppetlabs.com':
ensure: present
proxy: 'http://puppet_rack_app'
nginx::nginx_locations:
'static':
location: '~ "^/static/[0-9a-fA-F]{8}\/(.*)$"'
vhost: www.puppetlabs.com
'userContent':
location: /userContent
vhost: www.puppetlabs.com
www_root: /var/www/html
</pre>
12 changes: 11 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@
$configtest_enable = $nginx::params::nx_configtest_enable,
$service_restart = $nginx::params::nx_service_restart,
$mail = $nginx::params::nx_mail,
$server_tokens = $nginx::params::nx_server_tokens
$server_tokens = $nginx::params::nx_server_tokens,
$nginx_vhosts = {},
$nginx_upstreams = {},
$nginx_locations = {},
) inherits nginx::params {

include stdlib
Expand Down Expand Up @@ -72,6 +75,13 @@
service_restart => $service_restart,
}

validate_hash($nginx_upstreams)
create_resources('nginx::resource::upstream', $nginx_upstreams)
validate_hash($nginx_vhosts)
create_resources('nginx::resource::vhost', $nginx_vhosts)
validate_hash($nginx_locations)
create_resources('nginx::resource::location', $nginx_locations)

# Allow the end user to establish relationships to the "main" class
# and preserve the relationship to the implementation classes through
# a transitive relationship to the composite class.
Expand Down

0 comments on commit e1b0f83

Please sign in to comment.