diff --git a/CHANGELOG.md b/CHANGELOG.md index e06f2dd5..702f370e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Development +- Add configuration for redis based coordination and remove old style `$::osfamily` references. Contributed by @rush-skills ## 2.3.0 (Sep 15, 2021) diff --git a/manifests/auth/ldap.pp b/manifests/auth/ldap.pp index 56f5d7b6..e9d09a18 100644 --- a/manifests/auth/ldap.pp +++ b/manifests/auth/ldap.pp @@ -142,7 +142,7 @@ } # install package dependency - $_dep_pkgs = $::osfamily ? { + $_dep_pkgs = $facts['os']['family'] ? { 'Debian' => ['gcc', 'libldap2-dev'], 'RedHat' => ['gcc', 'openldap-devel'], default => undef, diff --git a/manifests/auth/pam.pp b/manifests/auth/pam.pp index da4f8d1c..f1dc1185 100644 --- a/manifests/auth/pam.pp +++ b/manifests/auth/pam.pp @@ -41,7 +41,7 @@ } # install package dependency - $_dep_pkgs = $::osfamily ? { + $_dep_pkgs = $facts['os']['family'] ? { 'Debian' => 'libpam0g', 'RedHat' => 'pam-devel', default => undef, diff --git a/manifests/init.pp b/manifests/init.pp index 2191d7a8..7ef0181a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -317,6 +317,9 @@ $erlang_url = $st2::params::erlang_url, $erlang_key = $st2::params::erlang_key, $redis_bind_ip = $st2::params::redis_bind_ip, + $redis_hostname = $st2::params::redis_hostname, + $redis_port = $st2::params::redis_port, + $redis_password = $st2::params::redis_password, $timersengine_enabled = $st2::params::timersengine_enabled, $timersengine_timezone = $st2::params::timersengine_timezone, $scheduler_sleep_interval = $st2::params::scheduler_sleep_interval, diff --git a/manifests/params.pp b/manifests/params.pp index a4b96fd4..b04d7b18 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -60,7 +60,7 @@ $st2_web_packages = [ 'st2web', ] - case $::osfamily { + case $facts['os']['family'] { 'Debian': { $st2_client_packages = [ 'python-st2client', @@ -186,18 +186,24 @@ $rabbitmq_vhost = '/' $erlang_url = "https://packagecloud.io/rabbitmq/erlang/el/${facts['os'][release][major]}/\$basearch" $erlang_key = 'https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey' + + ## Redis $redis_bind_ip = '127.0.0.1' + $redis_hostname = '127.0.0.1' + $redis_port = 6379 + $redis_password = '' + ## actionrunner config $actionrunner_workers = 10 - $actionrunner_global_env_file = $::osfamily ? { + $actionrunner_global_env_file = $facts['os']['family'] ? { 'Debian' => '/etc/default/st2actionrunner', 'RedHat' => '/etc/sysconfig/st2actionrunner', } ## chatops default config $st2_chatops_dir = '/opt/stackstorm/chatops' - $st2_chatops_global_env_file = $::osfamily ? { + $st2_chatops_global_env_file = $facts['os']['family'] ? { 'Debian' => '/etc/default/st2chatops', 'RedHat' => '/etc/sysconfig/st2chatops', } diff --git a/manifests/profile/mongodb.pp b/manifests/profile/mongodb.pp index 1300798b..3147e87a 100644 --- a/manifests/profile/mongodb.pp +++ b/manifests/profile/mongodb.pp @@ -95,7 +95,7 @@ # database, the re-enables auth. # # To prevent this from running every time we've create a puppet fact - # called $::mongodb_auth_init that is set when + # called $mongodb_auth_init that is set when if !$facts['mongodb_auth_init'] { # unfortinately there is no way to synchronously force a service restart # in Puppet, so we have to revert to exec... sorry diff --git a/manifests/profile/nodejs.pp b/manifests/profile/nodejs.pp index fdf40fda..fc18354e 100644 --- a/manifests/profile/nodejs.pp +++ b/manifests/profile/nodejs.pp @@ -52,8 +52,8 @@ # Red Hat 7.x + already have NodeJS 6.x installed # trying to install from nodesource repos fails, so just use the builtin - if ($::osfamily == 'RedHat' and - versioncmp($::operatingsystemmajrelease, '7') >= 0) { + if ($facts['os']['family'] == 'RedHat' and + versioncmp($facts['os']['release']['major'], '7') >= 0) { if $use_rhel7_builtin { class { 'nodejs': manage_package_repo => false, diff --git a/manifests/profile/rabbitmq.pp b/manifests/profile/rabbitmq.pp index a8ee86cc..562ae6f9 100644 --- a/manifests/profile/rabbitmq.pp +++ b/manifests/profile/rabbitmq.pp @@ -32,7 +32,7 @@ ) inherits st2 { # RHEL 8 Requires another repo in addition to epel to be installed - if ($::osfamily == 'RedHat') and ($facts['os']['release']['major'] == '8') { + if ($facts['os']['family'] == 'RedHat') and ($facts['os']['release']['major'] == '8') { $repos_ensure = true # This is required because when using the latest version of rabbitmq because the latest version in EPEL @@ -81,7 +81,7 @@ } # RHEL needs EPEL installed prior to rabbitmq - if $::osfamily == 'RedHat' { + if $facts['os']['family'] == 'RedHat' { Class['epel'] -> Class['rabbitmq'] diff --git a/manifests/profile/server.pp b/manifests/profile/server.pp index e714d42c..0b82bf2a 100644 --- a/manifests/profile/server.pp +++ b/manifests/profile/server.pp @@ -64,6 +64,9 @@ $rabbitmq_hostname = $st2::rabbitmq_hostname, $rabbitmq_port = $st2::rabbitmq_port, $rabbitmq_vhost = $st2::rabbitmq_vhost, + $redis_hostname = $st2::redis_hostname, + $redis_port = $st2::redis_port, + $redis_password = $st2::redis_password, $index_url = $st2::index_url, $packs_group = $st2::packs_group_name, ) inherits st2 { @@ -269,6 +272,17 @@ tag => 'st2::config', } + ## Coordination Settings (Redis) + + $_redis_url = "redis://:${redis_password}@${redis_hostname}:${redis_port}/" + ini_setting { 'coordination_url': + path => '/etc/st2/st2.conf', + section => 'coordination', + setting => 'url', + value => $_redis_url, + tag => 'st2::config', + } + ## Resultstracker Settings ini_setting { 'resultstracker_logging': ensure => present,