Skip to content

Commit

Permalink
Merge branch 'disable-yum-repo-management' of github.com:rytis/puppet…
Browse files Browse the repository at this point in the history
…-nginx into rytis-disable-yum-repo-management

Conflicts:
	manifests/init.pp
	manifests/package.pp
	manifests/params.pp
  • Loading branch information
James Fryman committed Oct 7, 2013
2 parents c314aa6 + b6ee1e5 commit 7ea6b57
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 38 deletions.
1 change: 1 addition & 0 deletions Puppetfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
forge 'http://forge.puppetlabs.com'

mod 'puppetlabs/stdlib', '>=0.1.6'
mod 'puppetlabs/apt', '>=1.0.0'
3 changes: 3 additions & 0 deletions Puppetfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
FORGE
remote: http://forge.puppetlabs.com
specs:
puppetlabs/apt (1.2.0)
puppetlabs/stdlib (>= 2.2.1)
puppetlabs/stdlib (4.1.0)

DEPENDENCIES
puppetlabs/apt (>= 1.0.0)
puppetlabs/stdlib (>= 0.1.6)

6 changes: 6 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,21 @@
$nginx_vhosts = {},
$nginx_upstreams = {},
$nginx_locations = {},
$manage_repo = $nginx::params::manage_repo,
) inherits nginx::params {

include stdlib

class { 'nginx::package':
<<<<<<< HEAD

This comment has been minimized.

Copy link
@fadenb

fadenb Oct 8, 2013

@jfryman: small merging accident?

package_name => $package_name,
package_source => $package_source,
package_ensure => $package_ensure,
notify => Class['nginx::service'],
=======
notify => Class['nginx::service'],
manage_repo => $manage_repo,
>>>>>>> b6ee1e59733eebaa410f7b4a18cc40c7c48be20e
}

class { 'nginx::config':
Expand Down
15 changes: 11 additions & 4 deletions manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,30 @@
$package_name = 'nginx',
$package_source = 'nginx',
$package_ensure = 'present',
$manage_repo = true,
) {
anchor { 'nginx::package::begin': }
anchor { 'nginx::package::end': }

case $::osfamily {
'redhat': {
class { 'nginx::package::redhat':
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
manage_repo => $manage_repo,
package_name => $package_name,
package_source => $package_source,
package_ensure => $package_ensure,
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
}
}
'debian': {
class { 'nginx::package::debian':
package_name => $package_name,
package_source => $package_source,
package_ensure => $package_ensure,
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
manage_repo => $manage_repo,
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
}
}
'suse': {
Expand All @@ -61,4 +67,5 @@
}
}
}
manage_repo => $manage_repo,
}
43 changes: 23 additions & 20 deletions manifests/package/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#
# This class file is not called directly
class nginx::package::debian(
$manage_repo = true,
$package_name = 'nginx',
$package_source = 'nginx',
$package_ensure = 'present'
Expand All @@ -29,31 +30,33 @@

include '::apt'

case $package_source {
'nginx': {
apt::source { 'nginx':
location => "http://nginx.org/packages/${distro}",
repos => 'nginx',
key => '7BD9BF62',
key_source => 'http://nginx.org/keys/nginx_signing.key',
if $manage_repo {
case $package_source {
'nginx': {
apt::source { 'nginx':
location => "http://nginx.org/packages/${distro}",
repos => 'nginx',
key => '7BD9BF62',
key_source => 'http://nginx.org/keys/nginx_signing.key',
}
}
}
'passenger': {
ensure_resource('package', 'apt-transport-https', {'ensure' => 'present' })
'passenger': {
ensure_resource('package', 'apt-transport-https', {'ensure' => 'present' })

apt::source { 'nginx':
location => 'https://oss-binaries.phusionpassenger.com/apt/passenger',
repos => "main",
key => '561F9B9CAC40B2F7',
key_source => 'https://oss-binaries.phusionpassenger.com/auto-software-signing-gpg-key.txt',
}
apt::source { 'nginx':
location => 'https://oss-binaries.phusionpassenger.com/apt/passenger',
repos => "main",
key => '561F9B9CAC40B2F7',
key_source => 'https://oss-binaries.phusionpassenger.com/auto-software-signing-gpg-key.txt',
}

package { 'passenger':
ensure => 'present',
require => Anchor['nginx::apt_repo'],
package { 'passenger':
ensure => 'present',
require => Anchor['nginx::apt_repo'],
}
}
default: {}
}
default: {}
}

exec { 'apt_get_update_for_nginx':
Expand Down
33 changes: 19 additions & 14 deletions manifests/package/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
# Sample Usage:
#
# This class file is not called directly
class nginx::package::redhat {
class nginx::package::redhat (
$manage_repo = true
) {
$redhat_packages = ['nginx', 'gd', 'libXpm', 'libxslt']

case $::operatingsystem {
Expand Down Expand Up @@ -42,23 +44,26 @@
# http://nginx.org/packages/centos appears to be identical to
# http://nginx.org/packages/rhel
# no other dedicated dirs exist for platforms under $::osfamily == redhat
yumrepo { 'nginx-release':
baseurl => "http://nginx.org/packages/rhel/${os_rel}/\$basearch/",
descr => 'nginx repo',
enabled => '1',
gpgcheck => '1',
priority => '1',
gpgkey => 'http://nginx.org/keys/nginx_signing.key',
if $manage_repo {
yumrepo { 'nginx-release':
baseurl => "http://nginx.org/packages/rhel/${os_rel}/\$basearch/",
descr => 'nginx repo',
enabled => '1',
gpgcheck => '1',
priority => '1',
gpgkey => 'http://nginx.org/keys/nginx_signing.key',
before => Package[$redhat_packages],
}
}

Yumrepo['nginx-release'] -> Package[$redhat_packages]
}
}

#Define file for nginx-repo so puppet doesn't delete it
file { '/etc/yum.repos.d/nginx-release.repo':
ensure => present,
require => Yumrepo['nginx-release'],
if $manage_repo {
#Define file for nginx-repo so puppet doesn't delete it
file { '/etc/yum.repos.d/nginx-release.repo':
ensure => present,
require => Yumrepo['nginx-release'],
}
}

package { $redhat_packages:
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,5 @@
$package_name = 'nginx'
$package_ensure = 'present'
$package_source = 'nginx'
$manage_repo = true
}

0 comments on commit 7ea6b57

Please sign in to comment.