Skip to content

Commit c8fd0de

Browse files
committed
Add official support for CentOS/RHEL 8
This change makes CentOS 8 and RHEL 8 as a suppotrted OS. For CentOS 8 RabbitMQ package is not available in EPEL and PackageCloud repos should be used instead. This change adds support for additional erlang repository so that users can install rabbitmq correctly without missing dependencies. [1] https://www.rabbitmq.com/install-rpm.html
1 parent 326a63c commit c8fd0de

17 files changed

+103
-82
lines changed

data/family/RedHat.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
rabbitmq::python_package: 'python3'
23
rabbitmq::package_name: 'rabbitmq-server'
34
rabbitmq::service_name: 'rabbitmq-server'
45
rabbitmq::package_gpg_key: 'https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey'
6+
rabbitmq::erlang_package_gpg_key: 'https://packagecloud.io/rabbitmq/erlang/gpgkey'

data/os/CentOS-7.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
rabbitmq::python_package: 'python'

data/os/RedHat-7.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
rabbitmq::python_package: 'python'

manifests/init.pp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@
213213
# RPM package GPG key to import. Uses source method. Should be a URL for Debian/RedHat OS family, or a file name for
214214
# RedHat OS family. Set to https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey for Debian/RedHat OS Family by
215215
# default. Note, that `key_content`, if specified, would override this parameter for Debian OS family.
216+
# @param erlang_package_gpg_key
217+
# RPM package GPG key to import for erlang packages. Uses source method. This is currently used by RedHat OS Family
218+
# only and should be a file name. Set to https://packagecloud.io/rabbitmq/erlang/gpgkey for RedHat OS Faimily by
219+
# default.
216220
# @param package_name
217221
# Name(s) of the package(s) to install
218222
# @param port
@@ -355,6 +359,7 @@
355359
Optional[Variant[Numeric, String]] $package_apt_pin = undef,
356360
String $package_ensure = 'installed',
357361
Optional[String] $package_gpg_key = undef,
362+
Optional[String] $erlang_package_gpg_key = undef,
358363
Variant[String, Array] $package_name = 'rabbitmq',
359364
Optional[String] $package_source = undef,
360365
Optional[String] $package_provider = undef,
@@ -475,6 +480,9 @@
475480
'RedHat': {
476481
contain rabbitmq::repo::rhel
477482
Class['rabbitmq::repo::rhel'] -> Class['rabbitmq::install']
483+
484+
contain rabbitmq::repo::rhel::erlang
485+
Class['rabbitmq::repo::rhel::erlang'] -> Class['rabbitmq::install']
478486
}
479487
'Debian': {
480488
contain rabbitmq::repo::apt

manifests/repo/rhel/erlang.pp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Makes sure that the Packagecloud repo for erlang is installed
2+
#
3+
# @api private
4+
class rabbitmq::repo::rhel::erlang (
5+
$location = "https://packagecloud.io/rabbitmq/erlang/el/${facts['os'][release][major]}/\$basearch",
6+
String $key_source = $rabbitmq::erlang_package_gpg_key,
7+
) {
8+
yumrepo { 'rabbitmq-erlang':
9+
ensure => present,
10+
name => 'rabbitmq_rabbitmq-erlang',
11+
baseurl => $location,
12+
gpgkey => $key_source,
13+
enabled => 1,
14+
gpgcheck => 1,
15+
}
16+
17+
# This may still be needed to prevent warnings
18+
# packagecloud key is gpg-pubkey-df309a0b-5bbb8d6e
19+
exec { "rpm --import ${key_source}":
20+
path => ['/bin','/usr/bin','/sbin','/usr/sbin'],
21+
unless => 'rpm -q gpg-pubkey-df309a0b-5bbb8d6e 2>/dev/null',
22+
}
23+
}

metadata.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
{
1212
"operatingsystem": "RedHat",
1313
"operatingsystemrelease": [
14-
"7"
14+
"7",
15+
"8"
1516
]
1617
},
1718
{
1819
"operatingsystem": "CentOS",
1920
"operatingsystemrelease": [
20-
"7"
21+
"7",
22+
"8"
2123
]
2224
},
2325
{

spec/acceptance/class_spec.rb

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
service_name = 'rabbitmq'
1717
end
1818

19+
repos_ensure = (fact('os.family') == 'RedHat')
20+
1921
context 'default class inclusion' do
2022
let(:pp) do
2123
<<-EOS
22-
class { 'rabbitmq': }
23-
if $facts['os']['family'] == 'RedHat' {
24-
class { 'erlang': epel_enable => true}
25-
Class['erlang'] -> Class['rabbitmq']
24+
class { 'rabbitmq':
25+
repos_ensure => #{repos_ensure},
2626
}
2727
EOS
2828
end
@@ -56,12 +56,9 @@ class { 'erlang': epel_enable => true}
5656
let(:pp) do
5757
<<-EOS
5858
class { 'rabbitmq':
59+
repos_ensure => #{repos_ensure},
5960
service_ensure => 'stopped',
6061
}
61-
if $facts['os']['family'] == 'RedHat' {
62-
class { 'erlang': epel_enable => true}
63-
Class['erlang'] -> Class['rabbitmq']
64-
}
6562
EOS
6663
end
6764

@@ -76,21 +73,16 @@ class { 'erlang': epel_enable => true}
7673
context 'service is unmanaged' do
7774
it 'runs successfully' do
7875
pp_pre = <<-EOS
79-
class { 'rabbitmq': }
80-
if $facts['os']['family'] == 'RedHat' {
81-
class { 'erlang': epel_enable => true}
82-
Class['erlang'] -> Class['rabbitmq']
76+
class { 'rabbitmq':
77+
repos_ensure => #{repos_ensure},
8378
}
8479
EOS
8580

8681
pp = <<-EOS
8782
class { 'rabbitmq':
83+
repos_ensure => #{repos_ensure},
8884
service_manage => false,
89-
service_ensure => 'stopped',
90-
}
91-
if $facts['os']['family'] == 'RedHat' {
92-
class { 'erlang': epel_enable => true}
93-
Class['erlang'] -> Class['rabbitmq']
85+
service_ensure => 'stopped',
9486
}
9587
EOS
9688

@@ -108,6 +100,7 @@ class { 'erlang': epel_enable => true}
108100
let(:pp) do
109101
<<-EOS
110102
class { 'rabbitmq':
103+
repos_ensure => #{repos_ensure},
111104
service_manage => true,
112105
port => 5672,
113106
admin_enable => true,
@@ -138,6 +131,7 @@ class { 'rabbitmq':
138131
let(:pp) do
139132
<<-EOS
140133
class { 'rabbitmq':
134+
repos_ensure => #{repos_ensure},
141135
service_manage => true,
142136
port => 5672,
143137
admin_enable => true,
@@ -169,6 +163,7 @@ class { 'rabbitmq':
169163
let(:pp) do
170164
<<-EOS
171165
class { 'rabbitmq':
166+
repos_ensure => #{repos_ensure},
172167
service_manage => true,
173168
admin_enable => true,
174169
node_ip_address => '0.0.0.0',
@@ -198,6 +193,7 @@ class { 'rabbitmq':
198193
let(:pp) do
199194
<<-EOS
200195
class { 'rabbitmq':
196+
repos_ensure => #{repos_ensure},
201197
service_manage => true,
202198
port => 5672,
203199
admin_enable => true,

spec/acceptance/clustering_spec.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
require 'spec_helper_acceptance'
22

33
describe 'rabbitmq clustering' do
4+
repos_ensure = (fact('os.family') == 'RedHat')
5+
46
context 'rabbitmq::wipe_db_on_cookie_change => false' do
57
it 'runs successfully' do
68
pp = <<-EOS
79
class { 'rabbitmq':
10+
repos_ensure => #{repos_ensure},
811
cluster => { 'name' => 'rabbit_cluster', 'init_node' => $facts['fqdn'] },
912
config_cluster => true,
1013
cluster_nodes => ['rabbit1', 'rabbit2'],
@@ -13,10 +16,6 @@ class { 'rabbitmq':
1316
erlang_cookie => 'TESTCOOKIE',
1417
wipe_db_on_cookie_change => false,
1518
}
16-
if $facts['os']['family'] == 'RedHat' {
17-
class { 'erlang': epel_enable => true}
18-
Class['erlang'] -> Class['rabbitmq']
19-
}
2019
EOS
2120

2221
apply_manifest(pp, expect_failures: true)
@@ -30,6 +29,7 @@ class { 'erlang': epel_enable => true}
3029
it 'runs successfully' do
3130
pp = <<-EOS
3231
class { 'rabbitmq':
32+
repos_ensure => #{repos_ensure},
3333
cluster => { 'name' => 'rabbit_cluster', 'init_node' => $facts['fqdn'] },
3434
config_cluster => true,
3535
cluster_nodes => ['rabbit1', 'rabbit2'],
@@ -38,10 +38,6 @@ class { 'rabbitmq':
3838
erlang_cookie => 'TESTCOOKIE',
3939
wipe_db_on_cookie_change => true,
4040
}
41-
if $facts['os']['family'] == 'RedHat' {
42-
class { 'erlang': epel_enable => true}
43-
Class['erlang'] -> Class['rabbitmq']
44-
}
4541
EOS
4642

4743
apply_manifest(pp, catch_failures: true)

spec/acceptance/delete_guest_user_spec.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
require 'spec_helper_acceptance'
22

33
describe 'rabbitmq with delete_guest_user' do
4+
repos_ensure = (fact('os.family') == 'RedHat')
5+
46
context 'delete_guest_user' do
57
it 'runs successfully' do
68
pp = <<-EOS
79
class { 'rabbitmq':
10+
repos_ensure => #{repos_ensure},
811
port => 5672,
912
delete_guest_user => true,
1013
}
11-
if $facts['os']['family'] == 'RedHat' {
12-
class { 'erlang': epel_enable => true}
13-
Class['erlang'] -> Class['rabbitmq']
14-
}
1514
EOS
1615

1716
apply_manifest(pp, catch_failures: true)

spec/acceptance/parameter_spec.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
require 'spec_helper_acceptance'
22

33
describe 'rabbitmq parameter on a vhost:' do
4+
repos_ensure = case fact('os.family')
5+
when 'RedHat'
6+
true
7+
end
8+
49
context 'create parameter resource' do
510
it 'runs successfully' do
611
pp = <<-EOS
7-
if $facts['os']['family'] == 'RedHat' {
8-
class { 'erlang': epel_enable => true }
9-
Class['erlang'] -> Class['rabbitmq']
10-
}
1112
class { 'rabbitmq':
13+
repos_ensure => #{repos_ensure},
1214
service_manage => true,
1315
port => 5672,
1416
delete_guest_user => true,

0 commit comments

Comments
 (0)