Skip to content
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
1 change: 1 addition & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- /ci/
- Puppetfile.lock
- '*.pyc'
- .vscode/
.gitlab-ci.yml:
# we don't use GitLab
unmanaged: true
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Development

- Update RabbitMQ installer to use latest Erlang from RabbitMQ repos. Contributed by @rush-skills

- Add support for a specific pack version/tag to be installed. Contributed by @rush-skills

- Add support for k/v to be set with api_key provided as config. Contributed by @rush-skills
Expand Down
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@
$rabbitmq_vhost = $st2::params::rabbitmq_vhost,
$erlang_url = $st2::params::erlang_url,
$erlang_key = $st2::params::erlang_key,
$erlang_key_id = $st2::params::erlang_key_id,
$erlang_key_source = $st2::params::erlang_key_source,
$erlang_packages = $st2::params::erlang_packages,
$redis_bind_ip = $st2::params::redis_bind_ip,
$redis_hostname = $st2::params::redis_hostname,
$redis_port = $st2::params::redis_port,
Expand Down
11 changes: 10 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,17 @@
$rabbitmq_port = 5672
$rabbitmq_bind_ip = '127.0.0.1'
$rabbitmq_vhost = '/'
$erlang_url = "https://packagecloud.io/rabbitmq/erlang/el/${facts['os'][release][major]}/\$basearch"
$osname = downcase($facts['os']['name'])
$erlang_url = $facts['os']['family'] ? {
'Debian' => "http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/${osname}",
'RedHat' => "https://packagecloud.io/rabbitmq/erlang/el/${facts['os'][release][major]}/\$basearch",
}
$erlang_key = 'https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey'
$erlang_key_id = 'B279943D2A549531E144B875F77F1EDA57EBB1CC'
$erlang_key_source = 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xf77f1eda57ebb1cc'
$erlang_packages = [
'erlang',
]

## Redis
$redis_bind_ip = '127.0.0.1'
Expand Down
60 changes: 52 additions & 8 deletions manifests/profile/rabbitmq.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,20 @@
# include st2::profile::rabbitmq
#
class st2::profile::rabbitmq (
$username = $st2::rabbitmq_username,
$password = $st2::rabbitmq_password,
$port = $st2::rabbitmq_port,
$bind_ip = $st2::rabbitmq_bind_ip,
$vhost = $st2::rabbitmq_vhost,
$erlang_url = $st2::erlang_url,
$erlang_key = $st2::erlang_key
$username = $st2::rabbitmq_username,
$password = $st2::rabbitmq_password,
$port = $st2::rabbitmq_port,
$bind_ip = $st2::rabbitmq_bind_ip,
$vhost = $st2::rabbitmq_vhost,
$erlang_url = $st2::erlang_url,
$erlang_key = $st2::erlang_key,
$erlang_key_id = $st2::erlang_key_id,
$erlang_key_source = $st2::erlang_key_source,
$erlang_packages = $st2::erlang_packages,
) inherits st2 {

# RHEL 8 Requires another repo in addition to epel to be installed
if ($facts['os']['family'] == 'RedHat') and ($facts['os']['release']['major'] == '8') {
if ($facts['os']['family'] == 'RedHat') {
$repos_ensure = true

# This is required because when using the latest version of rabbitmq because the latest version in EPEL
Expand All @@ -47,6 +50,42 @@
before => Class['rabbitmq::repo::rhel'],
}
}
elsif ($facts['os']['family'] == 'Debian') {
$repos_ensure = true
# trusty, xenial, bionic, etc
$release = downcase($facts['os']['distro']['codename'])
$repos = 'main'

apt::source { 'erlang':
ensure => 'present',
location => $erlang_url,
release => $release,
repos => $repos,
pin => '1000',
key => {
'id' => $erlang_key_id,
'source' => $erlang_key_source,
},
notify => Exec['apt-get-clean'],
tag => ['st2::rabbitmq::sources'],
}
# rebuild apt cache since we just changed repositories
# Executing it manually here to avoid dep cycles
exec { 'apt-get-clean':
command => '/usr/bin/apt-get -y clean',
refreshonly => true,
notify => Exec['apt-get-update'],
}
exec { 'apt-get-update':
command => '/usr/bin/apt-get -y update',
refreshonly => true,
}
package { $erlang_packages:
ensure => 'present',
tag => ['st2::packages', 'st2::rabbitmq::packages'],
require => Exec['apt-get-update'],
}
}
else {
$repos_ensure = false
}
Expand Down Expand Up @@ -91,4 +130,9 @@
Yumrepo['epel']
-> Package['rabbitmq-server']
}
# Debian/Ubuntu needs erlang before rabbitmq
elsif $facts['os']['family'] == 'Debian' {
Package<| tag == 'st2::rabbitmq::packages' |>
-> Class['rabbitmq']
}
}