forked from voxpupuli/puppet-nginx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reintegrate voxpupuli#331 (upstream exports/collections)
- resurrecting voxpupuli#331 from @rainopik - update (concat/stdlib) dependency version requirements based on current usage - fix upstream tests to work with rainopik's changes in what was voxpupuli#331
- Loading branch information
Showing
9 changed files
with
151 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
forge 'http://forge.puppetlabs.com' | ||
|
||
mod 'puppetlabs/stdlib', '>=0.1.6' | ||
mod 'puppetlabs/apt', '>=1.0.0' | ||
mod 'puppetlabs/concat', '>=1.0.0' | ||
mod 'puppetlabs/stdlib', '>= 3.0.0' | ||
mod 'puppetlabs/apt', '>= 1.0.0' | ||
mod 'puppetlabs/concat', '>= 1.1.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Define: nginx::resources::upstream::member | ||
# | ||
# Creates an upstream member inside the upstream block. Export this resource | ||
# in all upstream member servers and collect them on the NGINX server. | ||
# | ||
# | ||
# Requirements: | ||
# Requires storeconfigs on the Puppet Master to export and collect resources | ||
# | ||
# | ||
# Parameters: | ||
# [*upstream*] - The name of the upstream resource | ||
# [*server*] - Hostname or IP of the upstream member server | ||
# [*port*] - Port of the listening service on the upstream member | ||
# [*upstream_fail_timeout*] - Set the fail_timeout for the upstream. Default is 10 seconds | ||
# | ||
# | ||
# Examples: | ||
# | ||
# Exporting the resource on a upstream member server: | ||
# | ||
# @@nginx::resource::upstream::member { $::fqdn: | ||
# upstream => 'proxypass', | ||
# server => $::ipaddress, | ||
# port => '3000', | ||
# } | ||
# | ||
# | ||
# Collecting the resource on the NGINX server: | ||
# | ||
# nginx::resource::upstream { 'proxypass': | ||
# ensure => present, | ||
# } | ||
# | ||
define nginx::resource::upstream::member ( | ||
$upstream, | ||
$server, | ||
$port = '80', | ||
$upstream_fail_timeout = '10s', | ||
) { | ||
|
||
# Uses: $server, $port, $upstream_fail_timeout | ||
concat::fragment { "${upstream}_upstream_member_${name}": | ||
target => "${nginx::config::conf_dir}/conf.d/${upstream}-upstream.conf", | ||
order => 40, | ||
content => template('nginx/conf.d/upstream_member.erb'), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
server <%= @server %>:<%= @port %> fail_timeout=<%= @upstream_fail_timeout %>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<% @members.each do |i| %> | ||
server <%= i %> fail_timeout=<%= @upstream_fail_timeout %>;<% end %> |