From 243d483f2897634dfcbd105ad7fe4aaf69e6f142 Mon Sep 17 00:00:00 2001 From: Ankur Singh Date: Thu, 13 Jan 2022 19:12:56 +0530 Subject: [PATCH 1/6] add official repos for installing rabbitmq --- manifests/profile/rabbitmq.pp | 74 +++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/manifests/profile/rabbitmq.pp b/manifests/profile/rabbitmq.pp index 562ae6f9..18947839 100644 --- a/manifests/profile/rabbitmq.pp +++ b/manifests/profile/rabbitmq.pp @@ -47,6 +47,75 @@ before => Class['rabbitmq::repo::rhel'], } } + elsif ($facts['os']['family'] == 'Debian') { + $repos_ensure = true + # debian, ubuntu, etc + $osname = downcase($facts['os']['name']) + # trusty, xenial, bionic, etc + $release = downcase($facts['os']['distro']['codename']) + $repos = 'main' + + $location_erlang = "https://packagecloud.io/rabbitmq/rabbitmq-erlang/${osname}" + $location_rabbitmq = "https://packagecloud.io/rabbitmq/rabbitmq-server/${osname}" + + $erlang_packages = [ + 'erlang-base', + 'erlang-asn1', + 'erlang-crypto', + 'erlang-eldap', + 'erlang-ftp', + 'erlang-inets', + 'erlang-mnesia', + 'erlang-os-mon', + 'erlang-parsetools', + 'erlang-public-key', + 'erlang-runtime-tools', + 'erlang-snmp', + 'erlang-ssl', + 'erlang-syntax-tools', + 'erlang-tftp', + 'erlang-tools', + 'erlang-xmerl', + ] + + $erlang_key_id = '0xf77f1eda57ebb1cc' + $erlang_key_source = 'https://keyserver.ubuntu.com' + + $rabbit_key_id = '8C695B0219AFDEB04A058ED8F4E789204D206F89' + $rabbit_key_source = 'https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey' + + $team_key_id = '0A9AF2115F4687BD29803A206B73A36E6026DFCA' + $team_key_source = 'hkps://keys.openpgp.org' + + apt::key { 'rabbitmq-team': + id => $team_key_id + server => 'https://keys.openpgp.org' + } + + apt::source { 'erlang': + location => $location_erlang, + release => $release, + repos => $repos, + key => { + 'id' => $erlang_key_id, + 'source' => $erlang_key_source, + }, + + apt::source { 'rabbitmq': + location => $location_rabbitmq, + release => $release, + repos => $repos, + key => { + 'id' => $rabbit_key_id, + 'source' => $rabbit_key_source, + }, + } + + package { $erlang_packages: + ensure => 'present', + tag => ['st2::packages', 'st2::rabbitmq::packages'], + } + } else { $repos_ensure = false } @@ -91,4 +160,9 @@ Yumrepo['epel'] -> Package['rabbitmq-server'] } + # Debian/Ubuntu needs erlang before rabbitmq + elsif $facts['os']['family'] == 'Debian' { + Package<| tag == 'st2::rabbitmq::packages' |> + -> Class['rabbitmq'] + } } From 92bc719bd6506c351714cb4d2b839f5a8a37b0a4 Mon Sep 17 00:00:00 2001 From: Ankur Singh Date: Thu, 13 Jan 2022 19:15:45 +0530 Subject: [PATCH 2/6] move to launchpad ppa for rabbitmq erlang --- manifests/init.pp | 3 ++ manifests/params.pp | 11 ++++- manifests/profile/rabbitmq.pp | 88 ++++++++++++----------------------- 3 files changed, 42 insertions(+), 60 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 16f67dd2..f1456759 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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, diff --git a/manifests/params.pp b/manifests/params.pp index 12879540..15308b0a 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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' diff --git a/manifests/profile/rabbitmq.pp b/manifests/profile/rabbitmq.pp index 18947839..825bd13c 100644 --- a/manifests/profile/rabbitmq.pp +++ b/manifests/profile/rabbitmq.pp @@ -22,13 +22,16 @@ # 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 @@ -49,71 +52,38 @@ } elsif ($facts['os']['family'] == 'Debian') { $repos_ensure = true - # debian, ubuntu, etc - $osname = downcase($facts['os']['name']) # trusty, xenial, bionic, etc $release = downcase($facts['os']['distro']['codename']) $repos = 'main' - $location_erlang = "https://packagecloud.io/rabbitmq/rabbitmq-erlang/${osname}" - $location_rabbitmq = "https://packagecloud.io/rabbitmq/rabbitmq-server/${osname}" - - $erlang_packages = [ - 'erlang-base', - 'erlang-asn1', - 'erlang-crypto', - 'erlang-eldap', - 'erlang-ftp', - 'erlang-inets', - 'erlang-mnesia', - 'erlang-os-mon', - 'erlang-parsetools', - 'erlang-public-key', - 'erlang-runtime-tools', - 'erlang-snmp', - 'erlang-ssl', - 'erlang-syntax-tools', - 'erlang-tftp', - 'erlang-tools', - 'erlang-xmerl', - ] - - $erlang_key_id = '0xf77f1eda57ebb1cc' - $erlang_key_source = 'https://keyserver.ubuntu.com' - - $rabbit_key_id = '8C695B0219AFDEB04A058ED8F4E789204D206F89' - $rabbit_key_source = 'https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey' - - $team_key_id = '0A9AF2115F4687BD29803A206B73A36E6026DFCA' - $team_key_source = 'hkps://keys.openpgp.org' - - apt::key { 'rabbitmq-team': - id => $team_key_id - server => 'https://keys.openpgp.org' - } - apt::source { 'erlang': - location => $location_erlang, + ensure => 'present', + location => $erlang_url, release => $release, repos => $repos, + pin => '1000', key => { 'id' => $erlang_key_id, 'source' => $erlang_key_source, - }, - - apt::source { 'rabbitmq': - location => $location_rabbitmq, - release => $release, - repos => $repos, - key => { - 'id' => $rabbit_key_id, - 'source' => $rabbit_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'], + ensure => 'present', + tag => ['st2::packages', 'st2::rabbitmq::packages'], + require => Exec['apt-get-update'], } } else { From d5b53850719c8db6edde975965b64c6d33cf1179 Mon Sep 17 00:00:00 2001 From: Ankur Singh Date: Sun, 16 Jan 2022 20:19:36 +0530 Subject: [PATCH 3/6] add vscode folder to gitignore in .sync.yml --- .sync.yml | 57 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/.sync.yml b/.sync.yml index d46903a3..263499c2 100644 --- a/.sync.yml +++ b/.sync.yml @@ -9,7 +9,8 @@ - /cover/ - /ci/ - Puppetfile.lock - - '*.pyc' + - "*.pyc" + - .vscode/ .gitlab-ci.yml: # we don't use GitLab unmanaged: true @@ -21,34 +22,34 @@ appveyor.yml: unmanaged: true Gemfile: required: - ':development': - - gem: 'puppet-lint-absolute_classname-check' + ":development": + - gem: "puppet-lint-absolute_classname-check" # pin to 2.0.0 to comply with new standard which removes the leading :: - version: '>= 2.0.0' - - gem: 'puppet-lint-absolute_template_path' - version: '>= 1.0.1' - - gem: 'puppet-lint-alias-check' - version: '>= 0.1.1' - - gem: 'puppet-lint-classes_and_types_beginning_with_digits-check' - version: '>= 0.1.2' - - gem: 'puppet-lint-concatenated_template_files-check' - version: '>= 0.1.1' - - gem: 'puppet-lint-file_ensure-check' - version: '>= 0.3.1' - - gem: 'puppet-lint-file_source_rights-check' - version: '>= 0.1.1' - - gem: 'puppet-lint-leading_zero-check' - version: '>= 0.1.1' - - gem: 'puppet-lint-resource_reference_syntax' - version: '>= 1.0.10' - - gem: 'puppet-lint-trailing_comma-check' - version: '>= 0.3.2' - - gem: 'puppet-lint-unquoted_string-check' - version: '>= 0.3.0' - - gem: 'puppet-lint-version_comparison-check' - version: '>= 0.2.1' + version: ">= 2.0.0" + - gem: "puppet-lint-absolute_template_path" + version: ">= 1.0.1" + - gem: "puppet-lint-alias-check" + version: ">= 0.1.1" + - gem: "puppet-lint-classes_and_types_beginning_with_digits-check" + version: ">= 0.1.2" + - gem: "puppet-lint-concatenated_template_files-check" + version: ">= 0.1.1" + - gem: "puppet-lint-file_ensure-check" + version: ">= 0.3.1" + - gem: "puppet-lint-file_source_rights-check" + version: ">= 0.1.1" + - gem: "puppet-lint-leading_zero-check" + version: ">= 0.1.1" + - gem: "puppet-lint-resource_reference_syntax" + version: ">= 1.0.10" + - gem: "puppet-lint-trailing_comma-check" + version: ">= 0.3.2" + - gem: "puppet-lint-unquoted_string-check" + version: ">= 0.3.0" + - gem: "puppet-lint-version_comparison-check" + version: ">= 0.2.1" spec/default_facts.yml: extra_facts: - root_home: '/root' + root_home: "/root" spec/spec_helper.rb: - mock_with: ':rspec' + mock_with: ":rspec" From 0b7912616564523870e67e070dad3b5ecd82bb2c Mon Sep 17 00:00:00 2001 From: Ankur Singh Date: Sun, 16 Jan 2022 20:21:23 +0530 Subject: [PATCH 4/6] add changelog entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11c9f3e2..a89ad3a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 From 6a90219582f7e0f56dd4e2085a435668cae1a06e Mon Sep 17 00:00:00 2001 From: Ankur Singh Date: Tue, 1 Mar 2022 15:46:58 +0100 Subject: [PATCH 5/6] revert double quotes in .sync.ym --- .sync.yml | 56 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.sync.yml b/.sync.yml index 263499c2..a0fd40c2 100644 --- a/.sync.yml +++ b/.sync.yml @@ -9,7 +9,7 @@ - /cover/ - /ci/ - Puppetfile.lock - - "*.pyc" + - '*.pyc' - .vscode/ .gitlab-ci.yml: # we don't use GitLab @@ -22,34 +22,34 @@ appveyor.yml: unmanaged: true Gemfile: required: - ":development": - - gem: "puppet-lint-absolute_classname-check" + ':development': + - gem: 'puppet-lint-absolute_classname-check' # pin to 2.0.0 to comply with new standard which removes the leading :: - version: ">= 2.0.0" - - gem: "puppet-lint-absolute_template_path" - version: ">= 1.0.1" - - gem: "puppet-lint-alias-check" - version: ">= 0.1.1" - - gem: "puppet-lint-classes_and_types_beginning_with_digits-check" - version: ">= 0.1.2" - - gem: "puppet-lint-concatenated_template_files-check" - version: ">= 0.1.1" - - gem: "puppet-lint-file_ensure-check" - version: ">= 0.3.1" - - gem: "puppet-lint-file_source_rights-check" - version: ">= 0.1.1" - - gem: "puppet-lint-leading_zero-check" - version: ">= 0.1.1" - - gem: "puppet-lint-resource_reference_syntax" - version: ">= 1.0.10" - - gem: "puppet-lint-trailing_comma-check" - version: ">= 0.3.2" - - gem: "puppet-lint-unquoted_string-check" - version: ">= 0.3.0" - - gem: "puppet-lint-version_comparison-check" - version: ">= 0.2.1" + version: '>= 2.0.0' + - gem: 'puppet-lint-absolute_template_path' + version: '>= 1.0.1' + - gem: 'puppet-lint-alias-check' + version: '>= 0.1.1' + - gem: 'puppet-lint-classes_and_types_beginning_with_digits-check' + version: '>= 0.1.2' + - gem: 'puppet-lint-concatenated_template_files-check' + version: '>= 0.1.1' + - gem: 'puppet-lint-file_ensure-check' + version: '>= 0.3.1' + - gem: 'puppet-lint-file_source_rights-check' + version: '>= 0.1.1' + - gem: 'puppet-lint-leading_zero-check' + version: '>= 0.1.1' + - gem: 'puppet-lint-resource_reference_syntax' + version: '>= 1.0.10' + - gem: 'puppet-lint-trailing_comma-check' + version: '>= 0.3.2' + - gem: 'puppet-lint-unquoted_string-check' + version: '>= 0.3.0' + - gem: 'puppet-lint-version_comparison-check' + version: '>= 0.2.1' spec/default_facts.yml: extra_facts: - root_home: "/root" + root_home: '/root' spec/spec_helper.rb: - mock_with: ":rspec" + mock_with: ':rspec' From f4dc51402f554f0af2b79905e7e2a3a915661db9 Mon Sep 17 00:00:00 2001 From: Ankur Singh Date: Tue, 1 Mar 2022 15:48:21 +0100 Subject: [PATCH 6/6] remove version check for redhat distros in rabbitmq installer --- manifests/profile/rabbitmq.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/profile/rabbitmq.pp b/manifests/profile/rabbitmq.pp index 825bd13c..f5a78199 100644 --- a/manifests/profile/rabbitmq.pp +++ b/manifests/profile/rabbitmq.pp @@ -35,7 +35,7 @@ ) 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