Skip to content

Commit

Permalink
Use official nginx apt repo of stable releases for debian/ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
ktham committed May 15, 2013
1 parent 2d06639 commit a97e038
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions manifests/package/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,37 @@
#
# This class file is not called directly
class nginx::package::debian {
$operatingsystem_lowercase = inline_template('<%= operatingsystem.downcase %>')

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

anchor { 'nginx::apt_repo' : }

file { '/etc/apt/sources.list.d/nginx.list':
ensure => present,
content => "deb http://nginx.org/packages/${operatingsystem_lowercase}/ ${::lsbdistcodename} nginx
deb-src http://nginx.org/packages/${operatingsystem_lowercase}/ ${::lsbdistcodename} nginx
",
mode => '0444',
require => Exec['add_nginx_apt_key'],
before => Anchor['nginx::apt_repo'],
}

exec { 'add_nginx_apt_key':
command => "/usr/bin/wget http://nginx.org/keys/nginx_signing.key -O - | /usr/bin/apt-key add -",
unless => '/usr/bin/apt-key list | /bin/grep -q nginx',
before => Anchor['nginx::apt_repo'],
}

exec { 'apt_get_update_for_nginx':
command => '/usr/bin/apt-get update',
timeout => 240,
returns => [ 0, 100 ],
refreshonly => true,
subscribe => File['/etc/apt/sources.list.d/nginx.list'],
before => Anchor['nginx::apt_repo'],
}
}

0 comments on commit a97e038

Please sign in to comment.