Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Switch to puppetlabs repo for both apt & yum

  • Loading branch information...
commit 5bd68213ade13d106e1a1f7b97d09dc79a9ac31f 1 parent 0161f36
@elasticdog authored
View
14 README.md
@@ -30,11 +30,19 @@ To use Puppet Sandbox, you must have the following items installed and working:
* [VirtualBox](https://www.virtualbox.org/)
* [Vagrant](http://vagrantup.com/)
+Puppet Sandbox has been designed for and tested with Vagrant base boxes running:
+
+* CentOS 5.7
+* Ubuntu 10.04 - Lucid Lynx
+
+...although it may work just fine with other distributions/versions. By
+default, Puppet Sandbox will download and use a 64-bit CentOS 5.7 base box
+for you.
+
Usage
=====
-Make sure you have a Vagrant base box named "centos57" (if you don't have one
-already, it will download a 64-bit CentOS 5.7 box for you), and you should be
+Make sure you have a compatible Vagrant base box, and then you should be
good to clone this repo and go:
$ vagrant box list
@@ -42,8 +50,6 @@ good to clone this repo and go:
$ git clone git://github.com/elasticdog/puppet-sandbox.git
$ cd puppet-sandbox/
-_**NOTE:** In the future, Puppet Sandbox will support other OS versions and distributions._
-
Initial Startup
---------------
View
4 TODO
@@ -1,3 +1,3 @@
-* Support CentOS 6 and Ubuntu
-* Add an easy way to specify desired Puppet version (maybe use yum.puppetlabs.com instead of EPEL)
+* Support CentOS 6 and Arch Linux
+* Add an easy way to specify desired Puppet version
* Make hosts file dynamic based on what is defined in Vagrantfile
View
BIN  provision/modules/mirrors/files/epel-release-5-4.noarch.rpm
Binary file not shown
View
44 provision/modules/mirrors/manifests/apt.pp
@@ -0,0 +1,44 @@
+# == Class: mirrors::apt
+#
+# This class installs the Puppet Labs APT repository.
+#
+# === Parameters
+#
+# === Actions
+#
+# - Install puppetlabs repository
+# - Perform initial sync to update package database
+#
+# === Requires
+#
+# === Sample Usage
+#
+# class { 'mirrors::apt': }
+#
+class mirrors::apt {
+
+ $puppetlabs_key = '4BD6EC30'
+
+ exec { 'apt_key_puppetlabs':
+ path => '/bin:/usr/bin',
+ unless => "/usr/bin/apt-key list | /bin/grep -q '${puppetlabs_key}'",
+ command => "apt-key adv --keyserver 'pgp.mit.edu' --recv-keys '${puppetlabs_key}'",
+ before => File[ 'puppetlabs.list' ],
+ }
+
+ file { 'puppetlabs.list':
+ ensure => present,
+ path => '/etc/apt/sources.list.d/puppetlabs.list',
+ owner => root,
+ group => root,
+ mode => '0644',
+ content => template('mirrors/puppetlabs.list.erb'),
+ }
+
+ exec { 'apt_update':
+ command => '/usr/bin/apt-get update',
+ subscribe => File[ 'puppetlabs.list' ],
+ refreshonly => true,
+ }
+
+}
View
21 provision/modules/mirrors/manifests/init.pp
@@ -1,14 +1,13 @@
# == Class: mirrors
#
-# This class installs the Extra Packages for Enterprise Linux (EPEL) repository
-# and would be the place to configure any other custom mirrors you may want.
+# This class loads the relevant distribution-specific package repository
+# manifests and would be the place to configure any other custom mirrors you
+# may want.
#
# === Parameters
#
# === Actions
#
-# - Install EPEL repository using upstream RPM
-#
# === Requires
#
# === Sample Usage
@@ -17,10 +16,16 @@
#
class mirrors {
- package { 'epel-release':
- ensure => installed,
- provider => rpm,
- source => 'puppet:///modules/mirrors/epel-release-5-4.noarch.rpm',
+ case $::operatingsystem {
+ 'centos', 'fedora', 'redhat', 'scientific': {
+ class { 'mirrors::yum': }
+ }
+ 'debian', 'ubuntu': {
+ class { 'mirrors::apt': }
+ }
+ default: {
+ fail("Module '${module_name}' is not currently supported by Puppet Sandbox on ${::operatingsystem}")
+ }
}
}
View
39 provision/modules/mirrors/manifests/yum.pp
@@ -0,0 +1,39 @@
+# == Class: mirrors::yum
+#
+# This class installs the Puppet Labs YUM repository.
+#
+# === Parameters
+#
+# === Actions
+#
+# - Install puppetlabs repository
+# - Perform initial sync to update package database
+#
+# === Requires
+#
+# === Sample Usage
+#
+# class { 'mirrors::yum': }
+#
+class mirrors::yum {
+
+ # can't rely on $lsbmajdistrelease being available on CentOS, and lsb's
+ # dependencies are huge, so don't force installation of the package
+ $os_release_major_version = regsubst($operatingsystemrelease, '^(\d+).*$', '\1')
+
+ file { 'puppetlabs.repo':
+ ensure => present,
+ path => '/etc/yum.repos.d/puppetlabs.repo',
+ owner => root,
+ group => root,
+ mode => '0644',
+ content => template('mirrors/puppetlabs.repo.erb'),
+ }
+
+ exec { 'yum_makecache':
+ command => '/usr/bin/yum makecache',
+ subscribe => File[ 'puppetlabs.repo' ],
+ refreshonly => true,
+ }
+
+}
View
2  provision/modules/mirrors/templates/puppetlabs.list.erb
@@ -0,0 +1,2 @@
+deb http://apt.puppetlabs.com <%= lsbdistcodename %> main
+deb-src http://apt.puppetlabs.com <%= lsbdistcodename %> main
View
13 provision/modules/mirrors/templates/puppetlabs.repo.erb
@@ -0,0 +1,13 @@
+[puppetlabs-products]
+name=Puppet Labs Products <%= os_release_major_version %> - $basearch
+baseurl=http://yum.puppetlabs.com/el/<%= os_release_major_version %>/products/$basearch
+gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
+enabled=1
+gpgcheck=1
+
+[puppetlabs-deps]
+name=Puppet Labs Dependencies <%= os_release_major_version %> - $basearch
+baseurl=http://yum.puppetlabs.com/el/<%= os_release_major_version %>/dependencies/$basearch
+gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
+enabled=1
+gpgcheck=1

1 comment on commit 5bd6821

@inkblot

Just tested this with Ubuntu 11.10 server, it works. My vagrant box isn't up on the webs yet, but it's just a stock veewee-produced ubuntu-11.10-server-amd64 box with no customizations.

Please sign in to comment.
Something went wrong with that request. Please try again.