Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switched YUM repo to use the new CentOS Storage group repository #69

Merged
merged 3 commits into from
Oct 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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,
Expand All @@ -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 ###
Expand Down
31 changes: 0 additions & 31 deletions files/RPM-GPG-KEY-gluster.pub

This file was deleted.

7 changes: 3 additions & 4 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down
68 changes: 12 additions & 56 deletions manifests/repo/yum.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <smerrill@covermymeds.com>
Expand All @@ -32,69 +23,34 @@
# 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 yet supported for ${::operatingsystem}.")
}

if $priority {
if ! defined( Package['yum-plugin-priorities'] ) {
package { 'yum-plugin-priorities':
ensure => installed,
before => Yumrepo["glusterfs-${arch}"],
before => Yumrepo["glusterfs-${::architecture}"],
}
}
}

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,
}

Yumrepo["glusterfs-${arch}"] -> Package<| tag == 'gluster-packages' |>
Yumrepo["glusterfs-${::architecture}"] -> Package<| tag == 'gluster-packages' |>

}