From 16213b8081d577a9dfabfda301396daf2f7fb79f Mon Sep 17 00:00:00 2001 From: Benjamin Merot Date: Tue, 6 Sep 2016 11:03:41 +0200 Subject: [PATCH] Switched YUM repo to use the new CentOS Storage group repository (issue #63 and #68) --- README.md | 37 ++++++++++++++------ files/RPM-GPG-KEY-gluster.pub | 31 ----------------- manifests/params.pp | 7 ++-- manifests/repo.pp | 3 +- manifests/repo/yum.pp | 64 ++++++----------------------------- 5 files changed, 42 insertions(+), 100 deletions(-) delete mode 100644 files/RPM-GPG-KEY-gluster.pub diff --git a/README.md b/README.md index 89915924..e81d2856 100644 --- a/README.md +++ b/README.md @@ -44,13 +44,29 @@ This class establishes a number of default values used by the other classes. You should not need to include or reference this class directly. ### repo.pp ### -This class optionally enables the upstream [Gluster.org](http://download.gluster.org/pub/) repositories. - -Currently, only the yum and apt repo types are implemented. - - class { ::gluster::repo: - version => '3.5.2', - } +This class enables the GlusterFS repository. Either [Gluster.org](http://download.gluster.org/pub/) for APT or [CentOS](https://wiki.centos.org/SpecialInterestGroup/Storage) managed YUM for EL. + +Fedora users can get GlusterFS packages directly from Fedora's repository. Red Hat users with a Gluster Storage subscription should set the appropriate subscription/repo for their OS. There for for both Fedora and Red Hat Gluster Storage users, the default upstream community repo should be off: +```puppet +gluster::repo => false +``` + +For systems using APT, the latest packages of the latest release will be installed by default. Otherwise, specify a version: +```puppet +class { ::gluster::repo: + version => '3.5.2', +} +``` + +For systems using YUM, the latest package from the 3.8 release branch will be installed. You can specify a specific version and release: +```puppet +class { ::gluster::repo: + release => '3.7', +} +class { ::gluster: + version => '3.7.12', +} +``` Package priorities are supported, but not activated by default. @@ -63,9 +79,9 @@ This is [useful](http://blog.gluster.org/2014/11/installing-glusterfs-3-4-x-3-5- ### install.pp ### This class handles the installation of the Gluster packages (both server and client). -If the upstream Gluster repo is enabled, this class will install packages from there. Otherwise it will attempt to use native OS packages. +If the upstream Gluster repo is enabled (default), this class will install packages from there. Otherwise it will attempt to use native OS packages. -Currently, RHEL 6, RHEL 7, Debian 8, Raspbian and Ubuntu provide native Gluster packages. +Currently, RHEL 6, RHEL 7, Debian 8, Raspbian and Ubuntu provide native Gluster packages (at least client). class { gluster::install: server => true, @@ -74,7 +90,8 @@ Currently, RHEL 6, RHEL 7, Debian 8, Raspbian and Ubuntu provide native Gluster version => 3.5.1-1.el6, } -Note that on Red Hat (and derivative) systems, the `version` parameter should match the version number used by yum for the RPM package. The `gluster::repo::yum` class will parse the version number to build the correct URL for the repo, but Puppet's invocation of `yum` will not work as desired unless you specify the full RPM version number. +Note that on Red Hat (and derivative) systems, the `version` parameter should match the version number used by yum for the RPM package. +Beware that Red Hat provides its own build of the GlusterFS FUSE client on RHEL but its minor version doesn't match the upstream. There for if you run a community GlusterFS server, you should try to match the version on your RHEL clients by running the community FUSE client. On Debian-based systems, only the first two version places are significant ("x.y"). The latest minor version from that release will be installed unless the "priority" parameter is used. ### client.pp ### diff --git a/files/RPM-GPG-KEY-gluster.pub b/files/RPM-GPG-KEY-gluster.pub deleted file mode 100644 index 7eb667c8..00000000 --- a/files/RPM-GPG-KEY-gluster.pub +++ /dev/null @@ -1,31 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1 - -mQENBFYEjzYBCADJJQNhYyCPmOwpYuJVk4ywq3bsWU9oDy/6OguoNheSobobVsP6 -cEi5CVYIB6SYJbdj27w7uSOgCWQM58wGBdQEH09P2cbYlqEhdqRzmw9B0wlcZbB9 -Kg2eiBVLH0wnWi3pHgtaltsSHI01qyyfS1cEXVZewmkrqcmXgjaChy8SYUPey43K -MJOe0TRL02PaPvXvX3jG1+J4XGTt/fb8slZrIdcUcO3W+mnINg1fut/mbD2RDSJH -yoexyQD1AP96oqxksS/EaCsUsjLgQ5BSiV9XerieDv+vMIBb/sKuhjoMcxtAJFwq -J/rqHXDxUrwo+Zoo4e2FQOw1E2DOwkO3t56tABEBAAG0N0dsdXN0ZXIgUGFja2Fn -ZXIgPGdsdXN0ZXJwYWNr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70gQkUn+rL791AUpIixhB/k5QN -alz10wyGWq+IROH3KvFE6MQuk4062M99+wjHjokHF/FdZUznCFJxECIoAPsLv5OX -bgKtHEB6OHVOzAdO0yAO39BTup8Wk6jF1tYT+ovNcxKEsUYsAWUgmHa4JVq+tvaD -Cb9v1xIj -=O+RH ------END PGP PUBLIC KEY BLOCK----- diff --git a/manifests/params.pp b/manifests/params.pp index 976426db..f93fe9f4 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -24,7 +24,8 @@ # parameters dealing with installation $install_server = true $install_client = true - $version = 'LATEST' + $release = '3.8' + $version = 'LATEST' # we explicitly do NOT set a priority here. The user must define # a priority in order to ensure that it is activated @@ -36,9 +37,7 @@ case $::osfamily { 'RedHat': { $repo = true - $repo_gpg_key_name = 'RPM-GPG-KEY-gluster.pub' - $repo_gpg_key_path = '/etc/pki/rpm-gpg/' - $repo_gpg_key_source = "puppet:///modules/${module_name}/${repo_gpg_key_name}" + $repo_gpg_key_source = "http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-${::operatingsystemmajrelease}" $server_package = $::operatingsystemmajrelease ? { # RHEL 6 and 7 provide Gluster packages natively diff --git a/manifests/repo.pp b/manifests/repo.pp index 9ea91676..25537442 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -25,12 +25,13 @@ # Copyright 2014 CoverMyMeds, unless otherwise noted # class gluster::repo ( + $release = $::gluster::params::release, $version = $::gluster::params::version, ) inherits ::gluster::params { case $::osfamily { 'RedHat': { class { '::gluster::repo::yum': - version => $version, + release => $release, } } 'Debian': { diff --git a/manifests/repo/yum.pp b/manifests/repo/yum.pp index 04554783..1942ae8f 100644 --- a/manifests/repo/yum.pp +++ b/manifests/repo/yum.pp @@ -5,24 +5,15 @@ # # === Parameters # -# version: the version to use when building the repo URL +# release: GlusterFS release, such as 3.6, 3.7 or 3.8 (specific package defined with 'gluster::version') # repo_key_name: the filename of this repo's GPG key # repo_key_path: the path to this repo's GPG key on the target system # repo_key_source: where to find this repo's GPG key # priority: YUM priority to set for the Gluster repo # # Currently only released versions are supported. If you want to use -# QA releases or pre-releases, you'll need to edit line 54 below +# QA releases or pre-releases, you'll need to edit line 47 -# === Examples -# -# Enable the Yum repo, and use the public key stored in a local module -# called "secure": -# -# class { gluster::repo::yum: -# repo_key_source => 'puppet:///modules/secure/gluster-repo-rpm-key', -# } -# # === Authors # # Scott Merrill @@ -32,49 +23,14 @@ # Copyright 2014 CoverMyMeds, unless otherwise noted # class gluster::repo::yum ( - $version = $::gluster::params::version, - $repo_key_name = $::gluster::params::repo_gpg_key_name, - $repo_key_path = $::gluster::params::repo_gpg_key_path, + $release = $::gluster::params::release, $repo_key_source = $::gluster::params::repo_gpg_key_source, $priority = $::gluster::params::repo_priority, ) inherits ::gluster::params { - # basic sanity check - if ! $version { - fail ('Version not specified: unable to define repo!') - } - - $repo_base = 'https://download.gluster.org/pub/gluster/glusterfs' - if $version == 'LATEST' { - $repo_ver = $version - } else { - if $version =~ /^\d\.\d$/ { - $repo_ver = "${version}/LATEST" - } elsif $version =~ /^(\d)\.(\d)\.(\d).*$/ { - $repo_ver = "${1}.${2}/${1}.${2}.${3}" - } else { - fail("${version} doesn't make sense!") - } - } - - # the Gluster repo only supports x86_64 and i386 - $arch = $::architecture ? { - 'x86_64' => 'x86_64', - /i\d86/ => 'i386', - default => false, - } - if ! $arch { - fail("Architecture ${::architecture} not yet supported.") - } - - $repo_url = "${repo_base}/${repo_ver}/EPEL.repo/epel-${::operatingsystemmajrelease}/${arch}/" - $repo_key = "${repo_key_path}${repo_key_name}" - if $repo_key_source { - file { $repo_key: - ensure => file, - source => $repo_key_source, - before => Yumrepo["glusterfs-${arch}"], - } + # CentOS Gluster repo only supports x86_64 + if $::architecture != 'x86_64' { + fail("Architecture ${::architecture} not supported.") } if $priority { @@ -86,12 +42,12 @@ } } - yumrepo { "glusterfs-${arch}": + yumrepo { "glusterfs-${::architecture}": enabled => 1, - baseurl => $repo_url, - descr => "GlusterFS ${arch}", + baseurl => "http://mirror.centos.org/centos/${::operatingsystemmajrelease}/storage/${::architecture}/gluster-${release}/", + descr => "CentOS-${::operatingsystemmajrelease} - Gluster ${release}", gpgcheck => 1, - gpgkey => "file://${repo_key}", + gpgkey => $repo_key_source, priority => $priority, }