diff --git a/.kitchen.yml b/.kitchen.yml index c70d17ea..91f0c9d6 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -85,6 +85,18 @@ platforms: puppetfile_path: build/rocky8-puppet7/Puppetfile manifest: test/fullinstall_python38.pp + # RockyLinux 8 - Puppet 7 + - name: rocky8-puppet7-hatest + driver: + platform: rockylinux + dockerfile: build/rocky8-puppet7/Dockerfile.kitchen + run_command: /sbin/init + volume: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + provisioner: + puppetfile_path: build/rocky8-puppet7/Puppetfile + manifest: test/fullinstall_hatest.pp + # Ubuntu Bionic with Systemd - Puppet 6 - name: ubuntu18-puppet6 driver: diff --git a/manifests/client/settings.pp b/manifests/client/settings.pp index 2f5bf45c..aaae92cc 100644 --- a/manifests/client/settings.pp +++ b/manifests/client/settings.pp @@ -12,6 +12,8 @@ # URL of the StackStorm API service # @param auth_url # URL of the StackStorm Auth service +# @param stream_url +# URL of the StackStorm Stream service # @param base_url # Base URL for other StackStorm services # @param username @@ -43,10 +45,11 @@ $auth = $st2::auth, $api_url = $st2::cli_api_url, $auth_url = $st2::cli_auth_url, + $stream_url = $st2::cli_stream_url, $base_url = $st2::cli_base_url, $username = $st2::cli_username, $password = $st2::cli_password, - $disable_credentials = false, + $disable_credentials = $st2::cli_disable_credentials, $api_version = $st2::cli_api_version, $cacert = $st2::cli_cacert, $debug = $st2::cli_debug, @@ -70,6 +73,11 @@ setting => 'url', value => $api_url, } + ini_setting { "${user}-st2_cli_stream_url": + section => 'stream', + setting => 'url', + value => $stream_url, + } ini_setting { "${user}-st2_cli_general_base_url": section => 'general', setting => 'base_url', diff --git a/manifests/component/actionrunner.pp b/manifests/component/actionrunner.pp new file mode 100644 index 00000000..b76fd447 --- /dev/null +++ b/manifests/component/actionrunner.pp @@ -0,0 +1,82 @@ +# @summary Manages the st2actionrunner service. +# +# Normally this class is instantiated by +st2::profile::fullinstall+. +# OR by +st2::profile::ha::runner+ +# However, advanced users can instantiate this class directly to configure +# and manage just the st2actionrunner service on a single node. +# Parameters for this class mirror the parameters in the st2 config. +# +# @see https://github.com/StackStorm/st2/blob/master/conf/st2.conf.sample#L337-L343 +# +# @example Basic usage +# include st2::component::actionrunner +# +# @example Customizing parameters +# class { 'st2::component::actionrunner': +# actionrunner_workers => 5, +# ssh_key_location => '/etc/secrets/my_ssh_key', +# } +# +# @param actionrunner_workers +# Number of action runners. +# @param ssh_key_location +# Path to ssh key for the runner user +# @param conf_file +# Path to st2 conf file +# @param actionrunner_services +# List of services for actionrunner +# +class st2::component::actionrunner ( + $actionrunner_workers = $st2::actionrunner_workers, + $ssh_key_location = $st2::ssh_key_location, + $conf_file = $st2::conf_file, + $actionrunner_services = $st2::params::actionrunner_services +) inherits st2 { + + $_logger_config = $st2::syslog ? { + true => 'syslog', + default => 'logging', + } + + ## SSH + ini_setting { 'ssh_key_stanley': + ensure => present, + path => $conf_file, + section => 'system_user', + setting => 'ssh_key_file', + value => $ssh_key_location, + tag => 'st2::config', + } + + ## ActionRunner settings + ini_setting { 'actionrunner_logging': + ensure => present, + path => $conf_file, + section => 'actionrunner', + setting => 'logging', + value => "/etc/st2/${_logger_config}.actionrunner.conf", + tag => 'st2::config', + } + + ## Resultstracker Settings (Part of Action Runner) + ini_setting { 'resultstracker_logging': + ensure => present, + path => $conf_file, + section => 'resultstracker', + setting => 'logging', + value => "/etc/st2/${_logger_config}.resultstracker.conf", + tag => 'st2::config', + } + + ######################################## + ## Services + service { $actionrunner_services: + ensure => 'running', + enable => true, + tag => 'st2::service', + } + + ######################################## + ## Datastore keys + class { 'st2::server::datastore_keys': } +} diff --git a/manifests/component/api.pp b/manifests/component/api.pp new file mode 100644 index 00000000..3277bc8e --- /dev/null +++ b/manifests/component/api.pp @@ -0,0 +1,85 @@ +# @summary Manages the st2api service. +# +# Normally this class is instantiated by +st2::profile::fullinstall+. +# OR by +st2::profile::ha::web+ +# However, advanced users can instantiate this class directly to configure +# and manage just the st2api service on a single node. +# Parameters for this class mirror the parameters in the st2 config. +# +# @see https://github.com/StackStorm/st2/blob/master/conf/st2.conf.sample#L337-L343 +# +# @example Basic usage +# include st2::component::api +# +# @example Customizing parameters +# class { 'st2::component::api': +# st2api_listen_ip => '127.0.0.1', +# st2api_listen_port => '9201', +# } +# +# @param partition_provider +# partition_provider for distribution strategy of sensors. +# @see https://docs.stackstorm.com/reference/sensor_partitioning.html +# @param conf_file +# Path to st2 conf file +# @param api_services +# List of services for API +# @param st2api_listen_ip +# IP to bind API server +# @param st2api_listen_port +# Port to bind API server +# +class st2::component::api ( + $conf_file = $st2::conf_file, + $api_services = $st2::params::api_services, + $st2api_listen_ip = '0.0.0.0', + $st2api_listen_port = '9101', +) inherits st2 { + + $_logger_config = $st2::syslog ? { + true => 'syslog', + default => 'logging', + } + + ## API Settings + ini_setting { 'api_listen_ip': + ensure => present, + path => $conf_file, + section => 'api', + setting => 'host', + value => $st2api_listen_ip, + tag => 'st2::config', + } + ini_setting { 'api_listen_port': + ensure => present, + path => $conf_file, + section => 'api', + setting => 'port', + value => $st2api_listen_port, + tag => 'st2::config', + } + ini_setting { 'api_allow_origin': + ensure => 'present', + path => $conf_file, + section => 'api', + setting => 'allow_origin', + value => '*', + tag => 'st2::config', + } + ini_setting { 'api_logging': + ensure => present, + path => $conf_file, + section => 'api', + setting => 'logging', + value => "/etc/st2/${_logger_config}.api.gunicorn.conf", + tag => 'st2::config', + } + + ######################################## + ## Services + service { $api_services: + ensure => 'running', + enable => true, + tag => 'st2::service', + } +} diff --git a/manifests/component/auth.pp b/manifests/component/auth.pp new file mode 100644 index 00000000..1d2edd37 --- /dev/null +++ b/manifests/component/auth.pp @@ -0,0 +1,90 @@ +# @summary Manages the st2auth service. +# +# Normally this class is instantiated by +st2::profile::fullinstall+. +# OR by +st2::profile::ha::web+ +# However, advanced users can instantiate this class directly to configure +# and manage just the st2auth service on a single node. +# Parameters for this class mirror the parameters in the st2 config. +# +# @see https://github.com/StackStorm/st2/blob/master/conf/st2.conf.sample#L337-L343 +# +# @example Basic usage +# include st2::component::auth +# +# @example Customizing parameters +# class { 'st2::component::auth': +# st2auth_listen_ip => '127.0.0.1', +# st2auth_listen_port => '9200', +# } +# +# @param conf_file +# Path to st2 conf file +# @param auth +# Enable or disable auth (default: true) +# @param st2auth_listen_ip +# IP to bind Auth server +# @param st2auth_listen_port +# Port to bind Auth server +# @param auth_services +# List of services for Auth +# +class st2::component::auth ( + $conf_file = $st2::conf_file, + $auth = $st2::auth, + $st2auth_listen_ip = '0.0.0.0', + $st2auth_listen_port = '9100', + $auth_services = $st2::params::auth_services, +) inherits st2 { + + $_enable_auth = $auth ? { + true => 'True', + default => 'False', + } + + $_logger_config = $st2::syslog ? { + true => 'syslog', + default => 'logging', + } + + ## Authentication Settings + ini_setting { 'auth': + ensure => present, + path => $conf_file, + section => 'auth', + setting => 'enable', + value => $_enable_auth, + tag => 'st2::config', + } + ini_setting { 'auth_listen_port': + ensure => present, + path => $conf_file, + section => 'auth', + setting => 'port', + value => $st2auth_listen_port, + tag => 'st2::config', + } + ini_setting { 'auth_listen_ip': + ensure => present, + path => $conf_file, + section => 'auth', + setting => 'host', + value => $st2auth_listen_ip, + tag => 'st2::config', + } + ini_setting { 'auth_logging': + ensure => present, + path => $conf_file, + section => 'auth', + setting => 'logging', + value => "/etc/st2/${_logger_config}.auth.gunicorn.conf", + tag => 'st2::config', + } + + ######################################## + ## Services + service { $auth_services: + ensure => 'running', + enable => true, + tag => 'st2::service', + } +} diff --git a/manifests/profile/chatops.pp b/manifests/component/chatops.pp similarity index 98% rename from manifests/profile/chatops.pp rename to manifests/component/chatops.pp index 78b06a9d..22c94880 100644 --- a/manifests/profile/chatops.pp +++ b/manifests/component/chatops.pp @@ -63,7 +63,7 @@ # }, # } # -class st2::profile::chatops ( +class st2::component::chatops ( $version = $st2::version, $hubot_log_level = $st2::chatops_hubot_log_level, $hubot_express_port = $st2::chatops_hubot_express_port, @@ -115,7 +115,7 @@ ######################################## ## Additional nodejs packages - include st2::profile::nodejs + include st2::dependency::nodejs $npm_package_defaults = { ensure => present, diff --git a/manifests/component/garbagecollector.pp b/manifests/component/garbagecollector.pp new file mode 100644 index 00000000..299ef5f4 --- /dev/null +++ b/manifests/component/garbagecollector.pp @@ -0,0 +1,46 @@ +# @summary Manages the st2garbagecollector service. +# +# Normally this class is instantiated by +st2::profile::fullinstall+. +# OR by +st2::profile::ha::solo+ +# However, advanced users can instantiate this class directly to configure +# and manage just the st2garbagecollector service on a single node. +# Parameters for this class mirror the parameters in the st2 config. +# +# @see https://github.com/StackStorm/st2/blob/master/conf/st2.conf.sample#L337-L343 +# +# @example Basic usage +# include st2::component::garbagecollector +# +# @param conf_file +# Path to st2 conf file +# @param garbagecollector_services +# List of services for garbagecollector +# +class st2::component::garbagecollector ( + $conf_file = $st2::conf_file, + $garbagecollector_services = $st2::params::garbagecollector_services, +) inherits st2 { + + $_logger_config = $st2::syslog ? { + true => 'syslog', + default => 'logging', + } + + ## Sensor container Settings + ini_setting { 'garbagecollector_logging': + ensure => present, + path => $conf_file, + section => 'garbagecollector', + setting => 'logging', + value => "/etc/st2/${_logger_config}.garbagecollector.conf", + tag => 'st2::config', + } + + ######################################## + ## Services + service { $garbagecollector_services: + ensure => 'running', + enable => true, + tag => 'st2::service', + } +} diff --git a/manifests/profile/metrics.pp b/manifests/component/metrics.pp similarity index 93% rename from manifests/profile/metrics.pp rename to manifests/component/metrics.pp index 8b420243..49509dab 100644 --- a/manifests/profile/metrics.pp +++ b/manifests/component/metrics.pp @@ -10,7 +10,7 @@ # The port for the metrics. Default='8125' # # @example Basic Usage -# include st2::profile::metrics +# include st2::component::metrics # # @example Customize (done via st2) # class { 'st2': @@ -19,9 +19,9 @@ # metric_host => '127.0.0.1', # metric_port => '8125', # } -# include st2::profile::metrics +# include st2::component::metrics # -class st2::profile::metrics ( +class st2::component::metrics ( $metrics_include = $st2::metrics_include, $metric_driver = $st2::metric_driver, $metric_host = $st2::metric_host, diff --git a/manifests/notifier.pp b/manifests/component/notifier.pp similarity index 92% rename from manifests/notifier.pp rename to manifests/component/notifier.pp index 1a1bd0d2..0b4182d9 100644 --- a/manifests/notifier.pp +++ b/manifests/component/notifier.pp @@ -1,6 +1,7 @@ # @summary Manages the st2notifier service (Orquesta) # # Normally this class is instantiated by +st2::profile::fullinstall+. +# OR by +st2::profile::ha::core+ # However, advanced users can instantiate this class directly to configure # and manage just the st2notifier service on a single node. # Parameters for this class mirror the parameters in the st2 config. @@ -8,14 +9,14 @@ # @see https://github.com/StackStorm/st2/blob/master/conf/st2.conf.sample # # @example Basic usage -# include st2::notifier +# include st2::component::notifier # # @param notifier_num # The number of notifiers to have in an active active state # @param notifier_services # Name of all the notifier services # -class st2::notifier ( +class st2::component::notifier ( $notifier_num = $st2::notifier_num, $notifier_services = $st2::params::notifier_services, ) inherits st2 { diff --git a/manifests/rulesengine.pp b/manifests/component/rulesengine.pp similarity index 92% rename from manifests/rulesengine.pp rename to manifests/component/rulesengine.pp index 3c0e573a..966df0bb 100644 --- a/manifests/rulesengine.pp +++ b/manifests/component/rulesengine.pp @@ -1,6 +1,7 @@ # @summary Manages the st2rulesengine service (Orquesta) # # Normally this class is instantiated by +st2::profile::fullinstall+. +# OR by +st2::profile::ha::core+ # However, advanced users can instantiate this class directly to configure # and manage just the st2rulesengine service on a single node. # Parameters for this class mirror the parameters in the st2 config. @@ -8,14 +9,14 @@ # @see https://github.com/StackStorm/st2/blob/master/conf/st2.conf.sample # # @example Basic usage -# include st2::rulesengine +# include st2::component::rulesengine # # @param rulesengine_num # The number of rulesengines to have in an active active state # @param rulesengine_services # Name of all the rulesengine services # -class st2::rulesengine ( +class st2::component::rulesengine ( $rulesengine_num = $st2::rulesengine_num, $rulesengine_services = $st2::params::rulesengine_services, ) inherits st2 { diff --git a/manifests/scheduler.pp b/manifests/component/scheduler.pp similarity index 93% rename from manifests/scheduler.pp rename to manifests/component/scheduler.pp index 90cdde33..77c9dcd2 100644 --- a/manifests/scheduler.pp +++ b/manifests/component/scheduler.pp @@ -1,6 +1,7 @@ # @summary Manages the st2scheduler service. # # Normally this class is instantiated by st2::profile::fullinstall. +# OR by +st2::profile::ha::core+ # However, advanced users can instantiate this class directly to configure # and manage just the st2scheduler service on a single node. # Parameters for this class mirror the parameters in the st2 config. @@ -8,10 +9,10 @@ # @see https://github.com/StackStorm/st2/blob/master/conf/st2.conf.sample#L251-L259 # # @example Basic usage -# include st2::scheduler +# include st2::component::scheduler # # @example Customizing parameters -# class { 'st2::scheduler': +# class { 'st2::component::scheduler': # sleep_interval => 60, # gc_interval => 120, # } @@ -27,7 +28,7 @@ # @param scheduler_services # Name of all the scheduler services. # -class st2::scheduler ( +class st2::component::scheduler ( $sleep_interval = $st2::scheduler_sleep_interval, $gc_interval = $st2::scheduler_gc_interval, $pool_size = $st2::scheduler_pool_size, diff --git a/manifests/component/sensorcontainer.pp b/manifests/component/sensorcontainer.pp new file mode 100644 index 00000000..9b41f378 --- /dev/null +++ b/manifests/component/sensorcontainer.pp @@ -0,0 +1,65 @@ +# @summary Manages the st2sensorcontainer service. +# +# Normally this class is instantiated by +st2::profile::fullinstall+. +# OR +st2::profile::ha::sensor+ +# However, advanced users can instantiate this class directly to configure +# and manage just the st2sensorcontainer service on a single node. +# Parameters for this class mirror the parameters in the st2 config. +# +# @see https://github.com/StackStorm/st2/blob/master/conf/st2.conf.sample#L337-L343 +# +# @example Basic usage +# include st2::component::sensorcontainer +# +# @example Customizing parameters +# class { 'st2::component::sensorcontainer': +# partition_provider => 'name:hash, hash_ranges:0..1024|2048..3072|2147483648..MAX', +# } +# +# @param partition_provider +# partition_provider for distribution strategy of sensors. +# @see https://docs.stackstorm.com/reference/sensor_partitioning.html +# @param conf_file +# Path to st2 conf file +# @param sensorcontainer_services +# List of services for sensorcontainer +# +# +class st2::component::sensorcontainer ( + $partition_provider = $st2::sensor_partition_provider, + $conf_file = $st2::conf_file, + $sensorcontainer_services = $st2::params::sensorcontainer_services, +) inherits st2 { + + $_logger_config = $st2::syslog ? { + true => 'syslog', + default => 'logging', + } + + ## Sensor container Settings + ini_setting { 'sensorcontainer_logging': + ensure => present, + path => $conf_file, + section => 'sensorcontainer', + setting => 'logging', + value => "/etc/st2/${_logger_config}.sensorcontainer.conf", + tag => 'st2::config', + } + + ini_setting { 'sensorcontainer_partitioning': + ensure => present, + path => $conf_file, + section => 'sensorcontainer', + setting => 'partition_provider', + value => $partition_provider, + tag => 'st2::config', + } + + ######################################## + ## Services + service { $sensorcontainer_services: + ensure => 'running', + enable => true, + tag => 'st2::service', + } +} diff --git a/manifests/component/stream.pp b/manifests/component/stream.pp new file mode 100644 index 00000000..85717da0 --- /dev/null +++ b/manifests/component/stream.pp @@ -0,0 +1,46 @@ +# @summary Manages the st2stream service. +# +# Normally this class is instantiated by +st2::profile::fullinstall+. +# OR by +st2::profile::ha::web+ +# However, advanced users can instantiate this class directly to configure +# and manage just the st2stream service on a single node. +# Parameters for this class mirror the parameters in the st2 config. +# +# @see https://github.com/StackStorm/st2/blob/master/conf/st2.conf.sample#L337-L343 +# +# @example Basic usage +# include st2::component::stream +# +# @param conf_file +# Path to st2 conf file +# @param stream_services +# List of services for stream +# +class st2::component::stream ( + $conf_file = $st2::conf_file, + $stream_services = $st2::params::stream_services, +) inherits st2 { + + $_logger_config = $st2::syslog ? { + true => 'syslog', + default => 'logging', + } + + ## Stream Settings + ini_setting { 'stream_logging': + ensure => present, + path => $conf_file, + section => 'stream', + setting => 'logging', + value => "/etc/st2/${_logger_config}.stream.gunicorn.conf", + tag => 'st2::config', + } + + ######################################## + ## Services + service { $stream_services: + ensure => 'running', + enable => true, + tag => 'st2::service', + } +} diff --git a/manifests/timersengine.pp b/manifests/component/timersengine.pp similarity index 93% rename from manifests/timersengine.pp rename to manifests/component/timersengine.pp index 5808bafe..61117d9f 100644 --- a/manifests/timersengine.pp +++ b/manifests/component/timersengine.pp @@ -1,6 +1,7 @@ # @summary Manages the st2timersengine service. # # Normally this class is instantiated by +st2::profile::fullinstall+. +# OR by +st2::profile::ha::solo+ # However, advanced users can instantiate this class directly to configure # and manage just the st2timersengine service on a single node. # Parameters for this class mirror the parameters in the st2 config. @@ -8,10 +9,10 @@ # @see https://github.com/StackStorm/st2/blob/master/conf/st2.conf.sample#L337-L343 # # @example Basic usage -# include st2::timersengine +# include st2::component::timersengine # # @example Customizing parameters -# class { 'st2::timersengine': +# class { 'st2::component::timersengine': # enabled => true, # timezone => 'America/Los_Angeles', # } @@ -21,7 +22,7 @@ # @param timezone # Timezone pertaining to the location where st2 is run. # -class st2::timersengine ( +class st2::component::timersengine ( $enabled = $st2::timersengine_enabled, $timezone = $st2::timersengine_timezone, ) inherits st2 { diff --git a/manifests/profile/web.pp b/manifests/component/web.pp similarity index 95% rename from manifests/profile/web.pp rename to manifests/component/web.pp index 1e1bc724..3f8c11c9 100644 --- a/manifests/profile/web.pp +++ b/manifests/component/web.pp @@ -1,5 +1,7 @@ # @summary Profile to install, configure and manage StackStorm web UI (st2web). # +# This component gets installed by +st2::profile::ha::web+ +# # @param nginx_ssl_ciphers # String or list of strings of acceptable SSL ciphers to configure nginx with. # @see http://nginx.org/en/docs/http/ngx_http_ssl_module.html @@ -32,9 +34,11 @@ # Version of StackStorm WebUI to install # @param web_root # Directory where the StackStorm WebUI site lives on the filesystem +# @param [Boolean] manage_ssl_dir +# Manage the directory for ssl_dir # # @example Basic Usage -# include st2::profile::web' +# include st2::component::web' # # @example Managing your own certificate # # create your own certificate and key in the correct locations @@ -45,14 +49,14 @@ # content => 'my privatekey data', # } # -# # instantiate this profile with ssl_cert_manage false -# class { 'st2::profile::web': +# # instantiate this component with ssl_cert_manage false +# class { 'st2::component::web': # ssl_cert_manage => false, # } # # # @example Change the SSL protocols and ciphers -# class { 'st2::profile::web': +# class { 'st2::component::web': # nginx_ssl_protocols => ['TLSv1.2'], # nginx_ssl_ciphers => [ # 'ECDHE-ECDSA-AES256-GCM-SHA384', @@ -60,7 +64,7 @@ # ], # } # -class st2::profile::web( +class st2::component::web( Variant[Array[String], String] $nginx_ssl_ciphers = $st2::nginx_ssl_ciphers, Variant[Array[String], String] $nginx_ssl_protocols = $st2::nginx_ssl_protocols, Stdlib::Port $nginx_ssl_port = $st2::nginx_ssl_port, @@ -71,6 +75,7 @@ String $ssl_key = $st2::ssl_key, String $version = $st2::version, String $web_root = $st2::web_root, + Boolean $manage_ssl_dir = $st2::manage_ssl_dir, Integer $basicstatus_port = $st2::nginx_basicstatus_port, Boolean $basicstatus_enabled = $st2::nginx_basicstatus_enabled, ) inherits st2 { @@ -78,7 +83,7 @@ # if we include this in st2::profile::fullinstall Anchor['pre_reqs'] then # a dependency cycle is created because we must modify the nginx config # in this profile. - include st2::profile::nginx + include st2::dependency::nginx include st2::params ## Install the packages @@ -89,9 +94,11 @@ notify => Service['nginx'], # notify to force a refresh if the package is updated } - ## Create ssl cert directory - file { $ssl_dir: - ensure => directory, + ## Create ssl cert directory if needed + if $manage_ssl_dir { + file { $ssl_dir: + ensure => directory, + } } ## optionally manage the SSL certificate used by nginx diff --git a/manifests/workflowengine.pp b/manifests/component/workflowengine.pp similarity index 92% rename from manifests/workflowengine.pp rename to manifests/component/workflowengine.pp index 04444dc3..682b8499 100644 --- a/manifests/workflowengine.pp +++ b/manifests/component/workflowengine.pp @@ -1,6 +1,7 @@ # @summary Manages the st2workflowengine service (Orquesta) # # Normally this class is instantiated by +st2::profile::fullinstall+. +# OR by +st2::profile::ha::core+ # However, advanced users can instantiate this class directly to configure # and manage just the st2workflowengine service on a single node. # Parameters for this class mirror the parameters in the st2 config. @@ -8,14 +9,14 @@ # @see https://github.com/StackStorm/st2/blob/master/conf/st2.conf.sample # # @example Basic usage -# include st2::workflowengine +# include st2::component::workflowengine # # @param workflowengine_num # The number of workflowengines to have in an active active state # @param workflowengine_services # Name of all the workflowengine services. # -class st2::workflowengine ( +class st2::component::workflowengine ( $workflowengine_num = $st2::workflowengine_num, $workflowengine_services = $st2::params::workflowengine_services, ) inherits st2 { diff --git a/manifests/config/common.pp b/manifests/config/common.pp new file mode 100644 index 00000000..c33a7ef6 --- /dev/null +++ b/manifests/config/common.pp @@ -0,0 +1,194 @@ +# @summary Common configuration for st2 +# +# @note This class doesn't need to be invoked directly, instead it's included +# by other installation profiles to setup the configuration properly +# +# @param version +# Version of the st2 package to install +# @param conf_dir +# The directory where st2 configs are stored +# @param conf_file +# The path where st2 config is stored +# @param index_url +# URL to custom st2 pack exchange +# @param packs_group +# owner group for packs directory +# @param validate_output_schema +# If output schema for actions/workflows should be validated +# @param manage_nfs_dirs +# If directories that might be shared between nodes should be managed by the module +# @param stanley_user +# name of the stackstorm user +# @param syslog_host +# Syslog host. Default: localhost +# @param syslog_protocol +# Syslog protocol. Default: udp +# @param syslog_port +# Syslog port. Default: 514 +# @param syslog_facility +# Syslog facility. Default: local7 +# +class st2::config::common ( + $version = $st2::version, + $conf_dir = $st2::conf_dir, + $conf_file = $st2::conf_file, + $index_url = $st2::index_url, + $packs_group = $st2::packs_group_name, + $validate_output_schema = $st2::validate_output_schema, + $manage_nfs_dirs = $st2::manage_nfs_dirs, + $stanley_user = $st2::stanley_user, + $syslog_host = $st2::syslog_host, + $syslog_port = $st2::syslog_port, + $syslog_facility = $st2::syslog_facility, + $syslog_protocol = $st2::syslog_protocol, +) inherits st2 { + include st2::notices + include st2::params + + $_validate_output_schema = $validate_output_schema ? { + true => 'True', + default => 'False', + } + + ######################################## + ## Packages + package { $st2::params::st2_server_packages: + ensure => $version, + tag => ['st2::packages', 'st2::server::packages'], + } + + ## Groups + ensure_resource('group', $packs_group, { + 'ensure' => present, + }) + + if $manage_nfs_dirs { + ensure_resource('file', '/opt/stackstorm', { + 'ensure' => 'directory', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0755', + 'tag' => 'st2::server', + }) + + ensure_resource('file', '/opt/stackstorm/packs', { + 'ensure' => 'directory', + 'owner' => 'root', + 'group' => $packs_group, + 'mode' => '0775', + 'tag' => 'st2::server', + 'recurse' => true, + }) + + ensure_resource('file', '/opt/stackstorm/virtualenvs', { + 'ensure' => 'directory', + 'owner' => 'root', + 'group' => $packs_group, + 'mode' => '0755', + 'tag' => 'st2::server', + 'recurse' => true, + }) + + ensure_resource('file', '/opt/stackstorm/configs', { + 'ensure' => 'directory', + 'owner' => 'st2', + 'group' => 'root', + 'mode' => '0755', + 'tag' => 'st2::server', + }) + + recursive_file_permissions { '/opt/stackstorm/packs': + owner => 'root', + group => $packs_group, + tag => 'st2::server', + } + + recursive_file_permissions { '/opt/stackstorm/virtualenvs': + owner => 'root', + group => $packs_group, + tag => 'st2::server', + } + } + + ######################################## + ## Config + file { $conf_dir: + ensure => directory, + } + + ## System Settings + ini_setting { 'validate_output_schema': + ensure => present, + path => $conf_file, + section => 'system', + setting => 'validate_output_schema', + value => $_validate_output_schema, + tag => 'st2::config', + } + + ## System User Setting (Override stanley user with this setting) + ini_setting { 'stanley_system_user': + ensure => present, + path => $conf_file, + section => 'system_user', + setting => 'user', + value => $stanley_user, + tag => 'st2::config', + } + + ## Exchange config + if $index_url { + ini_setting { 'exchange_index_url': + ensure => present, + path => $conf_file, + section => 'content', + setting => 'index_url', + value => $index_url, + tag => 'st2::config', + } + } + + ## Enable system debug + ini_setting { 'enable_system_debug': + ensure => present, + path => $conf_file, + section => 'system', + setting => 'debug', + value => 'True', + tag => 'st2::config', + } + + ## Syslog Settings + ini_setting { 'syslog_host': + ensure => present, + path => $conf_file, + section => 'syslog', + setting => 'host', + value => $syslog_host, + tag => 'st2::config', + } + ini_setting { 'syslog_protocol': + ensure => present, + path => $conf_file, + section => 'syslog', + setting => 'protocol', + value => $syslog_protocol, + tag => 'st2::config', + } + ini_setting { 'syslog_port': + ensure => present, + path => $conf_file, + section => 'syslog', + setting => 'port', + value => $syslog_port, + tag => 'st2::config', + } + ini_setting { 'syslog_facility': + ensure => present, + path => $conf_file, + section => 'syslog', + setting => 'facility', + value => $syslog_facility, + tag => 'st2::config', + } +} diff --git a/manifests/config/coordination.pp b/manifests/config/coordination.pp new file mode 100644 index 00000000..0736454f --- /dev/null +++ b/manifests/config/coordination.pp @@ -0,0 +1,38 @@ +# @summary Coordination (Redis) configuration for st2 +# +# @note This class doesn't need to be invoked directly, instead it's included +# by other installation profiles to setup the configuration properly +# +# @param conf_file +# The path where st2 config is stored +# @param redis_hostname +# Hostname of the redis instance to connect +# @param redis_port +# Port of the redis instance to connect +# @param redis_password +# Password of the redis instance to connect +# +# @example Basic Usage +# class { 'st2': +# redis_hostname => 'myredis.server.tld', +# redis_port => '6379', +# redis_password => 'supersecretpassword', +# } +# +class st2::config::coordination ( + $conf_file = $st2::conf_file, + $redis_hostname = $st2::redis_hostname, + $redis_port = $st2::redis_port, + $redis_password = $st2::redis_password, +) inherits st2 { + + ## Coordination Settings (Redis) + $_redis_url = "redis://:${redis_password}@${redis_hostname}:${redis_port}/" + ini_setting { 'coordination_url': + path => $conf_file, + section => 'coordination', + setting => 'url', + value => $_redis_url, + tag => 'st2::config', + } +} diff --git a/manifests/config/db.pp b/manifests/config/db.pp new file mode 100644 index 00000000..54307fd9 --- /dev/null +++ b/manifests/config/db.pp @@ -0,0 +1,72 @@ +# @summary Database (MongoDB) configuration for st2 +# +# @note This class doesn't need to be invoked directly, instead it's included +# by other installation profiles to setup the configuration properly +# +# @param conf_file +# The path where st2 config is stored +# @param db_host +# Hostname to talk to st2 db +# @param db_port +# Port for db server for st2 to talk to +# @param db_bind_ips +# Array of bind IP addresses for MongoDB to listen on +# @param db_name +# Name of db to connect to (default: 'st2') +# @param db_username +# Username to connect to db with (default: 'stackstorm') +# @param db_password +# Password for 'admin' and 'stackstorm' users in MongDB. +# If 'undef' then use $cli_password +# +class st2::config::db ( + $conf_file = $st2::conf_file, + $db_host = $st2::db_host, + $db_port = $st2::db_port, + $db_name = $st2::db_name, + $db_username = $st2::db_username, + $db_password = $st2::db_password, +) inherits st2 { + + ## Database settings (MongoDB) + ini_setting { 'database_host': + ensure => present, + path => $conf_file, + section => 'database', + setting => 'host', + value => $db_host, + tag => 'st2::config', + } + ini_setting { 'database_port': + ensure => present, + path => $conf_file, + section => 'database', + setting => 'port', + value => $db_port, + tag => 'st2::config', + } + ini_setting { 'database_username': + ensure => present, + path => $conf_file, + section => 'database', + setting => 'username', + value => $db_username, + tag => 'st2::config', + } + ini_setting { 'database_name': + ensure => present, + path => $conf_file, + section => 'database', + setting => 'db_name', + value => $db_name, + tag => 'st2::config', + } + ini_setting { 'database_password': + ensure => present, + path => $conf_file, + section => 'database', + setting => 'password', + value => $db_password, + tag => 'st2::config', + } +} diff --git a/manifests/config/messaging.pp b/manifests/config/messaging.pp new file mode 100644 index 00000000..8bbd4f3c --- /dev/null +++ b/manifests/config/messaging.pp @@ -0,0 +1,41 @@ +# @summary Messaging (RabbitMQ) configuration for st2 +# +# @note This class doesn't need to be invoked directly, instead it's included +# by other installation profiles to setup the configuration properly +# +# @param conf_file +# The path where st2 config is stored +# @param rabbitmq_username +# Username for the RabbitMQ connection +# @param rabbitmq_password +# Password for the RabbitMQ connection +# @param rabbitmq_hostname +# Hostname for the RabbitMQ connection +# @param rabbitmq_port +# Port for the RabbitMQ connection +# @param rabbitmq_vhost +# Vhost for the RabbitMQ connection +# +class st2::config::messaging ( + $conf_file = $st2::conf_file, + $rabbitmq_username = $st2::rabbitmq_username, + $rabbitmq_password = $st2::rabbitmq_password, + $rabbitmq_hostname = $st2::rabbitmq_hostname, + $rabbitmq_port = $st2::rabbitmq_port, + $rabbitmq_vhost = $st2::rabbitmq_vhost, +) inherits st2 { + + ## Messaging Settings (RabbitMQ) + + # URL encode the RabbitMQ password, in case it contains special characters that + # can mess up the URL in the config. + $_rabbitmq_pass = st2::urlencode($rabbitmq_password) + ini_setting { 'messaging_url': + ensure => present, + path => $conf_file, + section => 'messaging', + setting => 'url', + value => "amqp://${rabbitmq_username}:${_rabbitmq_pass}@${rabbitmq_hostname}:${rabbitmq_port}/${rabbitmq_vhost}", + tag => 'st2::config', + } +} diff --git a/manifests/config/runners.pp b/manifests/config/runners.pp new file mode 100644 index 00000000..7359b3a5 --- /dev/null +++ b/manifests/config/runners.pp @@ -0,0 +1,29 @@ +# @summary Runners (Actionrunner and SensorConainer) configuration for st2 +# +# @note This class doesn't need to be invoked directly, instead it's included +# by other installation profiles to setup the configuration properly +# +# @param actionrunner_workers +# Number of action runners. +# +class st2::config::runners ( + $actionrunner_workers = $st2::actionrunner_workers, +) inherits st2 { + file { $st2::params::actionrunner_global_env_file: + ensure => file, + owner => 'root', + group => 'root', + mode => '0644', + content => template('st2/etc/sysconfig/st2actionrunner.erb'), + tag => 'st2::config', + } + + file { $st2::params::sensorcontainer_global_env_file: + ensure => file, + owner => 'root', + group => 'root', + mode => '0644', + content => template('st2/etc/sysconfig/st2sensorcontainer.erb'), + tag => 'st2::config', + } +} diff --git a/manifests/profile/facter.pp b/manifests/dependency/facter.pp similarity index 55% rename from manifests/profile/facter.pp rename to manifests/dependency/facter.pp index b41c6a00..161fc6dc 100644 --- a/manifests/profile/facter.pp +++ b/manifests/dependency/facter.pp @@ -1,8 +1,8 @@ # @summary Setup custom fact locations # # @example Basic Usage -# include st2::profile::facter +# include st2::dependency::facter # -class st2::profile::facter { +class st2::dependency::facter { include facter } diff --git a/manifests/profile/mongodb.pp b/manifests/dependency/mongodb.pp similarity index 98% rename from manifests/profile/mongodb.pp rename to manifests/dependency/mongodb.pp index 3147e87a..becc2297 100644 --- a/manifests/profile/mongodb.pp +++ b/manifests/dependency/mongodb.pp @@ -18,7 +18,7 @@ # Boolean determining if auth should be enabled for MongoDB. # # @example Basic Usage -# include st2::profile::mongodb +# include st2::dependency::mongodb # # @example Customize (done via st2) # class { 'st2': @@ -27,9 +27,9 @@ # db_password => 'xyz123', # db_port => 12345, # } -# include st2::profile::mongodb +# include st2::dependency::mongodb # -class st2::profile::mongodb ( +class st2::dependency::mongodb ( $db_name = $st2::db_name, $db_username = $st2::db_username, $db_password = $st2::db_password, diff --git a/manifests/profile/nginx.pp b/manifests/dependency/nginx.pp similarity index 81% rename from manifests/profile/nginx.pp rename to manifests/dependency/nginx.pp index 7097b4d1..b8ae2252 100644 --- a/manifests/profile/nginx.pp +++ b/manifests/dependency/nginx.pp @@ -4,14 +4,14 @@ # Set this to false when you have your own repository for nginx # # @example Basic Usage -# include st2::profile::nginx +# include st2::dependency::nginx # # @example Disable managing the nginx repo so you can manage it yourself -# class { 'st2::profile::nginx': +# class { 'st2::dependency::nginx': # manage_repo => false, # } # -class st2::profile::nginx ( +class st2::dependency::nginx ( $manage_repo = $st2::nginx_manage_repo ) inherits st2 { class { 'nginx': diff --git a/manifests/profile/nodejs.pp b/manifests/dependency/nodejs.pp similarity index 96% rename from manifests/profile/nodejs.pp rename to manifests/dependency/nodejs.pp index fc18354e..0dc86353 100644 --- a/manifests/profile/nodejs.pp +++ b/manifests/dependency/nodejs.pp @@ -6,10 +6,10 @@ # and manage just the NodeJS installation on a single node. # # @example Basic Usage -# include st2::profile::nodejs +# include st2::dependency::nodejs # # @example Custom Parameters -# class { 'st2::profile::nodejs': +# class { 'st2::dependency::nodejs': # } # # @param manage_repo @@ -17,7 +17,7 @@ # @param version # Version of NodeJS to install. If not provided it will be auto-calcuated based on $st2::version # -class st2::profile::nodejs( +class st2::dependency::nodejs( $manage_repo = $st2::nodejs_manage_repo, $version = $st2::nodejs_version, ) inherits st2 { diff --git a/manifests/profile/python.pp b/manifests/dependency/python.pp similarity index 90% rename from manifests/profile/python.pp rename to manifests/dependency/python.pp index c3457a69..fe94e935 100644 --- a/manifests/profile/python.pp +++ b/manifests/dependency/python.pp @@ -7,7 +7,7 @@ # To install Python 3.8 on Ubuntu 16.05 specify 'python3.8'. # # @example Basic Usage -# include st2::profile::python +# include st2::dependency::python # # @example Install with python 3.8 (if not default on your system) # $st2_python_version = $facts['os']['family'] ? { @@ -17,9 +17,9 @@ # class { 'st2': # python_version => $st2_python_version, # } -# include st2::profile::python +# include st2::dependency::python # -class st2::profile::python ( +class st2::dependency::python ( String $version = $st2::python_version, ) inherits st2 { notice("Python version: ${version}") diff --git a/manifests/profile/rabbitmq.pp b/manifests/dependency/rabbitmq.pp similarity index 97% rename from manifests/profile/rabbitmq.pp rename to manifests/dependency/rabbitmq.pp index e5c6eeab..f49b5ac9 100644 --- a/manifests/profile/rabbitmq.pp +++ b/manifests/dependency/rabbitmq.pp @@ -12,16 +12,16 @@ # RabbitMQ virtual host to create for StackStorm # # @example Basic Usage -# include st2::profile::rabbitmq +# include st2::dependency::rabbitmq # # @example Authentication enabled (configured vi st2) # class { 'st2': # rabbitmq_username => 'rabbitst2', # rabbitmq_password => 'secret123', # } -# include st2::profile::rabbitmq +# include st2::dependency::rabbitmq # -class st2::profile::rabbitmq ( +class st2::dependency::rabbitmq ( $username = $st2::rabbitmq_username, $password = $st2::rabbitmq_password, $port = $st2::rabbitmq_port, diff --git a/manifests/profile/redis.pp b/manifests/dependency/redis.pp similarity index 85% rename from manifests/profile/redis.pp rename to manifests/dependency/redis.pp index dc81e6e0..56c8cba2 100644 --- a/manifests/profile/redis.pp +++ b/manifests/dependency/redis.pp @@ -4,14 +4,14 @@ # Bind IP of the Redis server. Default is 127.0.0.1 # # @example Basic Usage -# include st2::profile::redis +# include st2::dependency::redis # # @example Install with redis # class { 'st2::profile::redis': # bind_ip => '127.0.0.1', # } # -class st2::profile::redis ( +class st2::dependency::redis ( String $bind_ip = $st2::redis_bind_ip, ) inherits st2 { diff --git a/manifests/profile/selinux.pp b/manifests/dependency/selinux.pp similarity index 90% rename from manifests/profile/selinux.pp rename to manifests/dependency/selinux.pp index 5a96d0c3..ff5e2b4b 100644 --- a/manifests/profile/selinux.pp +++ b/manifests/dependency/selinux.pp @@ -1,9 +1,9 @@ # @summary Configure SELinux so that StackStorm services run properly # # @example Basic Usage -# include st2::profile::selinux +# include st2::dependency::selinux # -class st2::profile::selinux inherits st2::params { +class st2::dependency::selinux inherits st2::params { # note: the selinux module downcases the mode in the fact if ( ($facts['os']['family'] == 'RedHat') and ($facts['os']['selinux']['current_mode'] == 'enforcing')) { if (Numeric($facts['os']['release']['major']) >= 8) { # package was renamed in el8 diff --git a/manifests/init.pp b/manifests/init.pp index 19fce3e4..c2f3225d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -31,6 +31,11 @@ # @param ssl_key # Path to the file where the StackStorm SSL key will # be generated. (default: /etc/ssl/st2/st2.key) +# @param [Boolean] manage_ssl_dir +# Manage the directory for ssl_dir +# (default: True) +# @param hostname +# Hostname of the StackStorm instance, used by other services to communicate # @param auth # Toggle to enable/disable auth (Default: true) # @param auth_api_url @@ -62,6 +67,8 @@ # CLI config - Enable/Disable Debug # @param cli_cache_token # CLI config - True to cache auth token until expries +# @param [boolean] cli_disable_credentials +# CLI config - False to setup the admin credentials (Default: false) # @param cli_username # CLI config - Auth Username # @param cli_password @@ -72,6 +79,8 @@ # CLI config - API URL # @param cli_auth_url # CLI config - Auth URL +# @param cli_stream_url +# CLI config - Stream URL # @param actionrunner_workers # Set the number of actionrunner processes to start # @param packs @@ -204,6 +213,12 @@ # for NodeJS (default: true) # @param redis_bind_ip # Bind IP of the Redis server. Default is 127.0.0.1 +# @param redis_hostname +# Hostname of the redis instance to connect +# @param redis_port +# Port of the redis instance to connect +# @param redis_password +# Password of the redis instance to connect # @param workflowengine_num # The number of workflowengines to have in an active active state (default: 1) # @param scheduler_num @@ -212,12 +227,28 @@ # The number of rulesengines to have in an active active state (default: 1) # @param notifier_num # The number of notifiers to have in an active active state (default: 1) +# @param rabbitmq_username +# Username for the RabbitMQ connection +# @param rabbitmq_password +# Password for the RabbitMQ connection +# @param rabbitmq_hostname +# Hostname for the RabbitMQ connection +# @param rabbitmq_port +# Port for the RabbitMQ connection +# @param rabbitmq_vhost +# Vhost for the RabbitMQ connection +# @param rabbitmq_bind_ip +# Bind IP for RabbitMQ server # @param erlang_url # The url for the erlang repositiory to be used for rabbitmq # @param erlang_key # The gpg key for the erlang repositiory to be used for rabbitmq # @param validate_output_schema # Enable/disable output schema validation in StackStorm +# @param manage_nfs_dirs +# If directories that might be shared between nodes should be managed by the module +# @param stanley_user +# name of the stackstorm user # # # @example Basic Usage @@ -258,63 +289,68 @@ # class { 'st2': # python_version => $st2_python_version, # } +# class st2( $version = 'present', String $python_version = 'system', St2::Repository $repository = $st2::params::repository, - $conf_dir = $st2::params::conf_dir, - $conf_file = "${st2::params::conf_dir}/st2.conf", - $use_ssl = $st2::params::use_ssl, - $ssl_cert_manage = true, - $ssl_dir = $st2::params::ssl_dir, - $ssl_cert = $st2::params::ssl_cert, - $ssl_key = $st2::params::ssl_key, - $auth = true, - $auth_api_url = "http://${st2::params::hostname}:${st2::params::api_port}", - $auth_debug = false, - $auth_mode = $st2::params::auth_mode, - $auth_backend = $st2::params::auth_backend, - $auth_backend_config = $st2::params::auth_backend_config, - $cli_base_url = "http://${st2::params::hostname}", - $cli_api_version = 'v1', - $cli_debug = false, - $cli_cache_token = true, - $cli_silence_ssl_warnings = false, - $cli_username = $st2::params::admin_username, - $cli_password = $st2::params::admin_password, - $cli_apikey = undef, - $cli_api_url = "http://${st2::params::hostname}:${st2::params::api_port}", - $cli_auth_url = "http://${st2::params::hostname}:${st2::params::auth_port}", - $actionrunner_workers = $st2::params::actionrunner_workers, - $packs = {}, - $packs_group = $st2::params::packs_group_name, - $index_url = undef, - $syslog = false, - $syslog_host = 'localhost', - $syslog_protocol = 'udp', - $syslog_port = 514, - $syslog_facility = 'local7', - $ssh_key_location = '/home/stanley/.ssh/st2_stanley_key', - $db_host = $st2::params::hostname, - $db_port = $st2::params::mongodb_port, - $db_bind_ips = $st2::params::mongodb_bind_ips, - $db_name = $st2::params::mongodb_st2_db, - $db_username = $st2::params::mongodb_st2_username, - $db_password = $st2::params::admin_password, - $mongodb_version = undef, - $mongodb_manage_repo = true, - $mongodb_auth = true, - $ng_init = true, - $datastore_keys_dir = $st2::params::datstore_keys_dir, - $datastore_key_path = "${st2::params::datstore_keys_dir}/datastore_key.json", - $nginx_basicstatus_enabled = $st2::params::basicstatus_enabled, - $nginx_basicstatus_port = $st2::params::basicstatus_port, - $nginx_manage_repo = true, + $conf_dir = $st2::params::conf_dir, + $conf_file = "${st2::params::conf_dir}/st2.conf", + $use_ssl = $st2::params::use_ssl, + $ssl_cert_manage = true, + $ssl_dir = $st2::params::ssl_dir, + $ssl_cert = $st2::params::ssl_cert, + $ssl_key = $st2::params::ssl_key, + $manage_ssl_dir = true, + $hostname = $st2::params::hostname, + $auth = true, + $auth_api_url = "http://${st2::params::hostname}:${st2::params::api_port}", + $auth_debug = false, + $auth_mode = $st2::params::auth_mode, + $auth_backend = $st2::params::auth_backend, + $auth_backend_config = $st2::params::auth_backend_config, + $cli_base_url = "https://${st2::hostname}", + $cli_api_version = 'v1', + $cli_debug = false, + $cli_cache_token = true, + $cli_silence_ssl_warnings = false, + $cli_disable_credentials = false, + $cli_username = $st2::params::admin_username, + $cli_password = $st2::params::admin_password, + $cli_apikey = undef, + $cli_api_url = "https://${st2::hostname}/api", + $cli_auth_url = "https://${st2::hostname}/auth", + $cli_stream_url = "https://${st2::hostname}/stream", + $actionrunner_workers = $st2::params::actionrunner_workers, + $packs = {}, + $packs_group = $st2::params::packs_group_name, + $index_url = undef, + $syslog = false, + $syslog_host = 'localhost', + $syslog_protocol = 'udp', + $syslog_port = 514, + $syslog_facility = 'local7', + $ssh_key_location = '/home/stanley/.ssh/st2_stanley_key', + $db_host = $st2::params::hostname, + $db_port = $st2::params::mongodb_port, + $db_bind_ips = $st2::params::mongodb_bind_ips, + $db_name = $st2::params::mongodb_st2_db, + $db_username = $st2::params::mongodb_st2_username, + $db_password = $st2::params::admin_password, + $mongodb_version = undef, + $mongodb_manage_repo = true, + $mongodb_auth = true, + $ng_init = true, + $datastore_keys_dir = $st2::params::datstore_keys_dir, + $datastore_key_path = "${st2::params::datstore_keys_dir}/datastore_key.json", + $nginx_basicstatus_enabled = $st2::params::basicstatus_enabled, + $nginx_basicstatus_port = $st2::params::basicstatus_port, + $nginx_manage_repo = true, $nginx_client_max_body_size = $st2::params::nginx_client_max_body_size, - $nginx_ssl_ciphers = $st2::params::nginx_ssl_ciphers, - $nginx_ssl_port = $st2::params::nginx_ssl_port, - $nginx_ssl_protocols = $st2::params::nginx_ssl_protocols, - $web_root = $st2::params::web_root, + $nginx_ssl_ciphers = $st2::params::nginx_ssl_ciphers, + $nginx_ssl_port = $st2::params::nginx_ssl_port, + $nginx_ssl_protocols = $st2::params::nginx_ssl_protocols, + $web_root = $st2::params::web_root, $rabbitmq_username = $st2::params::rabbitmq_username, $rabbitmq_password = $st2::params::rabbitmq_password, $rabbitmq_hostname = $st2::params::rabbitmq_hostname, @@ -347,21 +383,24 @@ $chatops_hubot_name = $st2::params::hubot_name, $chatops_hubot_alias = $st2::params::hubot_alias, $chatops_api_key = undef, - $chatops_st2_hostname = $st2::params::hostname, - $chatops_api_url = "https://${st2::params::hostname}/api", - $chatops_auth_url = "https://${st2::params::hostname}/auth", - $chatops_web_url = undef, - $nodejs_version = undef, - $nodejs_manage_repo = true, - $workflowengine_num = $st2::params::workflowengine_num, - $scheduler_num = $st2::params::scheduler_num, - $rulesengine_num = $st2::params::rulesengine_num, - $notifier_num = $st2::params::notifier_num, - $metrics_include = $st2::params::metrics_include, - $metric_driver = $st2::params::metric_driver, - $metric_host = $st2::params::metric_host, - $metric_port = $st2::params::metric_port, - $validate_output_schema = $st2::params::validate_output_schema, + $chatops_st2_hostname = $st2::hostname, + $chatops_api_url = "https://${st2::chatops_st2_hostname}/api", + $chatops_auth_url = "https://${st2::chatops_st2_hostname}/auth", + $chatops_web_url = "https://${st2::chatops_st2_hostname}/", + $sensor_partition_provider = $st2::params::sensor_partition_provider, + $nodejs_version = undef, + $nodejs_manage_repo = true, + $workflowengine_num = $st2::params::workflowengine_num, + $scheduler_num = $st2::params::scheduler_num, + $rulesengine_num = $st2::params::rulesengine_num, + $notifier_num = $st2::params::notifier_num, + $metrics_include = $st2::params::metrics_include, + $metric_driver = $st2::params::metric_driver, + $metric_host = $st2::params::metric_host, + $metric_port = $st2::params::metric_port, + $validate_output_schema = $st2::params::validate_output_schema, + $manage_nfs_dirs = true, + $stanley_user = $st2::params::st2_stanley_user, ) inherits st2::params { ######################################## diff --git a/manifests/logging/rsyslog.pp b/manifests/logging/rsyslog.pp index e10ea54a..91c317c1 100644 --- a/manifests/logging/rsyslog.pp +++ b/manifests/logging/rsyslog.pp @@ -6,6 +6,7 @@ # # @example Basic usage # include st2::logging::rsyslog +# class st2::logging::rsyslog { file { '/etc/rsyslog.d/10-st2.conf': ensure => file, diff --git a/manifests/params.pp b/manifests/params.pp index 0b36fd76..897a1685 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -85,14 +85,42 @@ } } + $st2_stanley_user = 'stanley' + ## StackStorm core services $st2_services = [ - 'st2actionrunner', 'st2api', 'st2auth', + 'st2stream', + ] + + ## StackStorm EndPoint Services + # StackStorm Auth Services + $auth_services = [ + 'st2auth', + ] + # StackStorm API Services + $api_services = [ + 'st2api', + ] + # StackStorm Stream Services + $stream_services = [ + 'st2stream', + ] + + ## StackStorm ActionRunner Services + $actionrunner_services = [ + 'st2actionrunner', + ] + + ## StackStorm Garbage Collector Services + $garbagecollector_services = [ 'st2garbagecollector', + ] + + ## StackStorm Sensor Services + $sensorcontainer_services = [ 'st2sensorcontainer', - 'st2stream', ] ## StackStorm Workflow Engine (Orchestra) @@ -223,6 +251,14 @@ 'RedHat' => '/etc/sysconfig/st2actionrunner', } + ## actionrunner config + $sensorcontainer_global_env_file = $facts['os']['family'] ? { + 'Debian' => '/etc/default/st2sensorcontainer', + 'RedHat' => '/etc/sysconfig/st2sensorcontainer', + } + + $sensor_partition_provider = 'name:default' + ## chatops default config $st2_chatops_dir = '/opt/stackstorm/chatops' $st2_chatops_global_env_file = $facts['os']['family'] ? { diff --git a/manifests/profile/client.pp b/manifests/profile/client.pp index 07f05438..7eb0b76f 100644 --- a/manifests/profile/client.pp +++ b/manifests/profile/client.pp @@ -30,6 +30,7 @@ $auth = $st2::auth, $api_url = $st2::cli_api_url, $auth_url = $st2::cli_auth_url, + $stream_url = $st2::cli_stream_url, $base_url = $st2::cli_base_url, $username = $st2::cli_username, $password = $st2::cli_password, @@ -46,6 +47,7 @@ auth => $auth, api_url => $api_url, auth_url => $auth_url, + stream_url => $stream_url, base_url => $base_url, username => $username, password => $password, diff --git a/manifests/profile/fullinstall.pp b/manifests/profile/fullinstall.pp index 8f54b913..cbca672b 100644 --- a/manifests/profile/fullinstall.pp +++ b/manifests/profile/fullinstall.pp @@ -6,6 +6,7 @@ # * MongoDB # * NodeJS # * nginx +# * redis # # @example Basic Usage # include st2::profile::fullinstall @@ -20,29 +21,17 @@ # class st2::profile::fullinstall inherits st2 { - anchor { 'st2::begin': } - -> anchor { 'st2::bootstrap': } - -> anchor { 'st2::pre_reqs': } - -> anchor { 'st2::main': } - -> anchor { 'st2::end': } - - Anchor['st2::begin'] - -> Anchor['st2::bootstrap'] - -> class { 'st2::profile::facter': } + class { 'st2::dependency::facter': } -> class { 'st2::repo': } - -> class { 'st2::profile::selinux': } - -> Anchor['st2::pre_reqs'] - -> class { 'st2::profile::redis': } - -> class { 'st2::profile::python': } - -> class { 'st2::profile::nodejs': } - -> class { 'st2::profile::rabbitmq': } - -> class { 'st2::profile::mongodb': } - -> Anchor['st2::main'] + -> class { 'st2::dependency::selinux': } + -> class { 'st2::dependency::redis': } + -> class { 'st2::dependency::python': } + -> class { 'st2::dependency::nodejs': } + -> class { 'st2::dependency::rabbitmq': } + -> class { 'st2::dependency::mongodb': } -> class { 'st2::profile::client': } -> class { 'st2::profile::server': } - -> class { 'st2::profile::web': } - -> class { 'st2::profile::chatops': } - -> Anchor['st2::end'] + -> class { 'st2::component::chatops': } include st2::auth include st2::packs diff --git a/manifests/profile/ha.pp b/manifests/profile/ha.pp new file mode 100644 index 00000000..651682cd --- /dev/null +++ b/manifests/profile/ha.pp @@ -0,0 +1,35 @@ +# @summary Base profile to install and configure HA st2 installation +# +class st2::profile::ha ( +) inherits st2 { + + contain st2::config::common + contain st2::config::db + contain st2::config::messaging + contain st2::config::coordination + contain st2::config::runners + + ######################################## + ## Dependencies + Package<| tag == 'st2::server::packages' |> + -> Ini_setting<| tag == 'st2::config' |> + ~> Service<| tag == 'st2::service' |> + + Package<| tag == 'st2::server::packages' |> + -> Class['st2::server::datastore_keys'] + -> Service<| tag == 'st2::service' |> + + Package<| tag == 'st2::server::packages' |> + -> Class['st2::stanley'] + -> Service<| tag == 'st2::service' |> + + Package<| tag == 'st2::server::packages' |> + -> File<| tag == 'st2::server' |> + -> Service<| tag == 'st2::service' |> + + Service<| tag == 'st2::service' |> + ~> Exec<| tag == 'st2::reload' |> + + St2_pack<||> + ~> Recursive_file_permissions<| tag == 'st2::server' |> +} diff --git a/manifests/profile/ha/core.pp b/manifests/profile/ha/core.pp new file mode 100644 index 00000000..672e7c8d --- /dev/null +++ b/manifests/profile/ha/core.pp @@ -0,0 +1,12 @@ +# @summary Profile to install, configure and manage all core components for st2 +# +# @example Basic usage +# include st2::profile::ha::core +# +class st2::profile::ha::core ( +) inherits st2::profile::ha { + contain st2::component::notifier + contain st2::component::rulesengine + contain st2::component::scheduler + contain st2::component::workflowengine +} diff --git a/manifests/profile/ha/runner.pp b/manifests/profile/ha/runner.pp new file mode 100644 index 00000000..da2a53b1 --- /dev/null +++ b/manifests/profile/ha/runner.pp @@ -0,0 +1,9 @@ +# @summary Profile to install, configure and manage actionrunner for st2 +# +# @example Basic usage +# include st2::profile::ha::runner +# +class st2::profile::ha::runner ( +) inherits st2::profile::ha { + contain st2::component::actionrunner +} diff --git a/manifests/profile/ha/sensor.pp b/manifests/profile/ha/sensor.pp new file mode 100644 index 00000000..d80b8e08 --- /dev/null +++ b/manifests/profile/ha/sensor.pp @@ -0,0 +1,9 @@ +# @summary Profile to install, configure and manage sensorcontainer for st2 +# +# @example Basic usage +# include st2::profile::ha::sensor +# +class st2::profile::ha::sensor ( +) inherits st2::profile::ha { + contain st2::component::sensorcontainer +} diff --git a/manifests/profile/ha/solo.pp b/manifests/profile/ha/solo.pp new file mode 100644 index 00000000..656cfd45 --- /dev/null +++ b/manifests/profile/ha/solo.pp @@ -0,0 +1,10 @@ +# @summary Profile to install, configure and manage all NON HA server components for st2 +# +# @example Basic usage +# include st2::profile::ha::solo +# +class st2::profile::ha::solo ( +) inherits st2::profile::ha { + contain st2::component::timersengine + contain st2::component::garbagecollector +} diff --git a/manifests/profile/ha/web.pp b/manifests/profile/ha/web.pp new file mode 100644 index 00000000..e3bf337e --- /dev/null +++ b/manifests/profile/ha/web.pp @@ -0,0 +1,12 @@ +# @summary Profile to install, configure and manage all web and api components for st2 +# +# @example Basic usage +# include st2::profile::ha::web +# +class st2::profile::ha::web ( +) inherits st2::profile::ha { + contain st2::component::web + contain st2::component::api + contain st2::component::auth + contain st2::component::stream +} diff --git a/manifests/profile/server.pp b/manifests/profile/server.pp index 35b12c18..dc26204f 100644 --- a/manifests/profile/server.pp +++ b/manifests/profile/server.pp @@ -1,413 +1,36 @@ # @summary Profile to install, configure and manage all server components for st2 # -# @param version -# Version of StackStorm to install -# @param conf_dir -# The directory where st2 configs are stored -# @param conf_file -# The path where st2 config is stored -# @param auth -# Toggle Auth -# @param actionrunner_workers -# Set the number of actionrunner processes to start -# @param st2api_listen_ip -# Listen IP for st2api process -# @param st2api_listen_port -# Listen port for st2api process -# @param st2auth_listen_ip -# Listen IP for st2auth process -# @param st2auth_listen_port -# Listen port for st2auth process -# @param syslog -# Routes all log messages to syslog -# @param syslog_host -# Syslog host. -# @param syslog_protocol -# Syslog protocol. -# @param syslog_port -# Syslog port. -# @param syslog_facility -# Syslog facility. -# @param ssh_key_location -# Location on filesystem of Admin SSH key for remote runner -# @param db_username -# Username to connect to MongoDB with (default: 'stackstorm') -# @param db_password -# Password for 'stackstorm' user in MongDB. -# @param index_url -# Url to the StackStorm Exchange index file. (default undef) -# # @example Basic usage # include st2::profile::server # class st2::profile::server ( - $version = $st2::version, - $conf_dir = $st2::conf_dir, - $conf_file = $st2::conf_file, - $auth = $st2::auth, - $actionrunner_workers = $st2::actionrunner_workers, - $syslog = $st2::syslog, - $syslog_host = $st2::syslog_host, - $syslog_port = $st2::syslog_port, - $syslog_facility = $st2::syslog_facility, - $syslog_protocol = $st2::syslog_protocol, - $st2api_listen_ip = '127.0.0.1', - $st2api_listen_port = '9101', - $st2auth_listen_ip = '127.0.0.1', - $st2auth_listen_port = '9100', - $ssh_key_location = $st2::ssh_key_location, - $ng_init = $st2::ng_init, - $db_username = $st2::db_username, - $db_password = $st2::db_password, - $rabbitmq_username = $st2::rabbitmq_username, - $rabbitmq_password = $st2::rabbitmq_password, - $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, - $validate_output_schema = $st2::validate_output_schema, ) inherits st2 { - include st2::notices - include st2::params - - $_enable_auth = $auth ? { - true => 'True', - default => 'False', - } - $_validate_output_schema = $validate_output_schema ? { - true => 'True', - default => 'False', - } - $_logger_config = $syslog ? { - true => 'syslog', - default => 'logging', - } - - ######################################## - ## Packages - package { $st2::params::st2_server_packages: - ensure => $version, - tag => ['st2::packages', 'st2::server::packages'], - } - - ensure_resource('file', '/opt/stackstorm', { - 'ensure' => 'directory', - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0755', - 'tag' => 'st2::server', - }) - ensure_resource('group', $packs_group, { - 'ensure' => present, - }) + contain st2::config::common + contain st2::config::db + contain st2::config::messaging + contain st2::config::coordination + contain st2::config::runners - ensure_resource('file', '/opt/stackstorm/configs', { - 'ensure' => 'directory', - 'owner' => 'st2', - 'group' => 'root', - 'mode' => '0755', - 'tag' => 'st2::server', - }) + contain st2::component::actionrunner + contain st2::component::sensorcontainer + contain st2::component::web + contain st2::component::api + contain st2::component::auth + contain st2::component::stream - ensure_resource('file', '/opt/stackstorm/packs', { - 'ensure' => 'directory', - 'owner' => 'root', - 'group' => $packs_group, - 'mode' => '0775', - 'tag' => 'st2::server', - }) + contain st2::component::notifier + contain st2::component::rulesengine + contain st2::component::scheduler + contain st2::component::timersengine + contain st2::component::workflowengine + contain st2::component::garbagecollector - ensure_resource('file', '/opt/stackstorm/virtualenvs', { - 'ensure' => 'directory', - 'owner' => 'root', - 'group' => $packs_group, - 'mode' => '0755', - 'tag' => 'st2::server', - }) - - recursive_file_permissions { '/opt/stackstorm/packs': - owner => 'root', - group => $packs_group, - tag => 'st2::server', - } - - recursive_file_permissions { '/opt/stackstorm/virtualenvs': - owner => 'root', - group => $packs_group, - tag => 'st2::server', - } - - ######################################## - ## Config - file { $conf_dir: - ensure => directory, - } - - ## SSH - ini_setting { 'ssh_key_stanley': - ensure => present, - path => $conf_file, - section => 'system_user', - setting => 'ssh_key_file', - value => $ssh_key_location, - tag => 'st2::config', - } - - ## ActionRunner settings - ini_setting { 'actionrunner_logging': - ensure => present, - path => $conf_file, - section => 'actionrunner', - setting => 'logging', - value => "/etc/st2/${_logger_config}.actionrunner.conf", - tag => 'st2::config', - } - - file { $st2::params::actionrunner_global_env_file: - ensure => file, - owner => 'root', - group => 'root', - mode => '0644', - content => template('st2/etc/sysconfig/st2actionrunner.erb'), - tag => 'st2::config', - } - - ## API Settings - ini_setting { 'api_listen_ip': - ensure => present, - path => $conf_file, - section => 'api', - setting => 'host', - value => $st2api_listen_ip, - tag => 'st2::config', - } - ini_setting { 'api_listen_port': - ensure => present, - path => $conf_file, - section => 'api', - setting => 'port', - value => $st2api_listen_port, - tag => 'st2::config', - } - ini_setting { 'api_allow_origin': - ensure => 'present', - path => $conf_file, - section => 'api', - setting => 'allow_origin', - value => '*', - tag => 'st2::config', - } - ini_setting { 'api_logging': - ensure => present, - path => $conf_file, - section => 'api', - setting => 'logging', - value => "/etc/st2/${_logger_config}.api.gunicorn.conf", - tag => 'st2::config', - } - - ## Authentication Settings - ini_setting { 'auth': - ensure => present, - path => $conf_file, - section => 'auth', - setting => 'enable', - value => $_enable_auth, - tag => 'st2::config', - } - ini_setting { 'auth_listen_port': - ensure => present, - path => $conf_file, - section => 'auth', - setting => 'port', - value => $st2auth_listen_port, - tag => 'st2::config', - } - ini_setting { 'auth_listen_ip': - ensure => present, - path => $conf_file, - section => 'auth', - setting => 'host', - value => $st2auth_listen_ip, - tag => 'st2::config', - } - ini_setting { 'auth_logging': - ensure => present, - path => $conf_file, - section => 'auth', - setting => 'logging', - value => "/etc/st2/${_logger_config}.auth.gunicorn.conf", - tag => 'st2::config', - } - - ## Database settings (MongoDB) - ini_setting { 'database_username': - ensure => present, - path => $conf_file, - section => 'database', - setting => 'username', - value => $db_username, - tag => 'st2::config', - } - ini_setting { 'database_password': - ensure => present, - path => $conf_file, - section => 'database', - setting => 'password', - value => $db_password, - tag => 'st2::config', - } - - ## Messaging Settings (RabbitMQ) - - # URL encode the RabbitMQ password, in case it contains special characters that - # can mess up the URL in the config. - $_rabbitmq_pass = st2::urlencode($rabbitmq_password) - ini_setting { 'messaging_url': - ensure => present, - path => '/etc/st2/st2.conf', - section => 'messaging', - setting => 'url', - value => "amqp://${rabbitmq_username}:${_rabbitmq_pass}@${rabbitmq_hostname}:${rabbitmq_port}/${rabbitmq_vhost}", - 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, - path => $conf_file, - section => 'resultstracker', - setting => 'logging', - value => "/etc/st2/${_logger_config}.resultstracker.conf", - tag => 'st2::config', - } - - ## Garbage collector Settings - ini_setting { 'garbagecollector_logging': - ensure => present, - path => $conf_file, - section => 'garbagecollector', - setting => 'logging', - value => "/etc/st2/${_logger_config}.garbagecollector.conf", - tag => 'st2::config', - } - - ## Sensor container Settings - ini_setting { 'sensorcontainer_logging': - ensure => present, - path => $conf_file, - section => 'sensorcontainer', - setting => 'logging', - value => "/etc/st2/${_logger_config}.sensorcontainer.conf", - tag => 'st2::config', - } - - ## Stream Settings - ini_setting { 'stream_logging': - ensure => present, - path => $conf_file, - section => 'stream', - setting => 'logging', - value => "/etc/st2/${_logger_config}.stream.gunicorn.conf", - tag => 'st2::config', - } - - class { 'st2::profile::metrics': } - - ## Syslog Settings - ini_setting { 'syslog_host': - ensure => present, - path => $conf_file, - section => 'syslog', - setting => 'host', - value => $syslog_host, - tag => 'st2::config', - } - ini_setting { 'syslog_protocol': - ensure => present, - path => $conf_file, - section => 'syslog', - setting => 'protocol', - value => $syslog_protocol, - tag => 'st2::config', - } - ini_setting { 'syslog_port': - ensure => present, - path => $conf_file, - section => 'syslog', - setting => 'port', - value => $syslog_port, - tag => 'st2::config', - } - ini_setting { 'syslog_facility': - ensure => present, - path => $conf_file, - section => 'syslog', - setting => 'facility', - value => $syslog_facility, - tag => 'st2::config', - } - - ## System Settings - ini_setting { 'validate_output_schema': - ensure => present, - path => $conf_file, - section => 'system', - setting => 'validate_output_schema', - value => $_validate_output_schema, - tag => 'st2::config', - } - - ## Exchange config - if $index_url { - ini_setting { 'exchange_index_url': - ensure => present, - path => $conf_file, - section => 'content', - setting => 'index_url', - value => $index_url, - tag => 'st2::config', - } - } - - ######################################## - ## Services - service { $st2::params::st2_services: - ensure => 'running', - enable => true, - tag => 'st2::service', - } - - contain st2::notifier - contain st2::rulesengine - contain st2::scheduler - contain st2::timersengine - contain st2::workflowengine + contain st2::component::metrics ######################################## ## st2 user (stanley) - class { 'st2::stanley': } - - ######################################## - ## Datastore keys - class { 'st2::server::datastore_keys': } + contain st2::stanley ######################################## ## Dependencies diff --git a/manifests/stanley.pp b/manifests/stanley.pp index bfe3f22a..20334c90 100644 --- a/manifests/stanley.pp +++ b/manifests/stanley.pp @@ -26,7 +26,7 @@ # } # class st2::stanley ( - $username = 'stanley', + $username = $st2::stanley_user, $ssh_public_key = undef, $ssh_key_type = undef, $ssh_private_key = undef, diff --git a/manifests/test/fullinstall_hatest.pp b/manifests/test/fullinstall_hatest.pp new file mode 100644 index 00000000..38bd97b9 --- /dev/null +++ b/manifests/test/fullinstall_hatest.pp @@ -0,0 +1,40 @@ +# Test for installing standalone StackStorm using Python 3.6 +$st2_python_version = $facts['os']['family'] ? { + 'RedHat' => '3.6', + 'Debian' => 'python3.6', +} +class { 'st2': + python_version => $st2_python_version, + cli_silence_ssl_warnings => true, # needed for clean pack install in tests +} + +class { 'st2::dependency::facter': } +-> class { 'st2::repo': } +-> class { 'st2::dependency::selinux': } +-> class { 'st2::dependency::redis': } +-> class { 'st2::dependency::python': } +-> class { 'st2::dependency::nodejs': } +-> class { 'st2::dependency::rabbitmq': } +-> class { 'st2::dependency::mongodb': } +-> class { 'st2::profile::client': } +-> class { 'st2::component::chatops': } + +include st2::profile::ha::sensor +include st2::profile::ha::web +include st2::profile::ha::core +include st2::profile::ha::solo +include st2::profile::ha::runner + +######################################## +## st2 user (stanley) + +class { 'st2::stanley': } + +include st2::auth +include st2::packs +include st2::kvs + +# If user has not defined a pack "st2", install it from the Exchange. +if ! defined(St2::Pack['st2']) { + ensure_resource('st2::pack', 'st2', {'ensure' => 'present'}) +} diff --git a/manifests/test/fullinstall_python38.pp b/manifests/test/fullinstall_python38.pp index be516959..32334d87 100644 --- a/manifests/test/fullinstall_python38.pp +++ b/manifests/test/fullinstall_python38.pp @@ -8,4 +8,5 @@ class { 'st2': python_version => $st2_python_version, } + include st2::profile::fullinstall diff --git a/spec/classes/profile/mongodb_spec.rb b/spec/classes/profile/mongodb_spec.rb index cf75da82..fd084183 100644 --- a/spec/classes/profile/mongodb_spec.rb +++ b/spec/classes/profile/mongodb_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'st2::profile::mongodb' do +describe 'st2::dependency::mongodb' do on_supported_os.each do |os, os_facts| let(:facts) { os_facts } diff --git a/spec/classes/profile/nginx_spec.rb b/spec/classes/profile/nginx_spec.rb index 36a96229..102f8ab5 100644 --- a/spec/classes/profile/nginx_spec.rb +++ b/spec/classes/profile/nginx_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'st2::profile::nginx' do +describe 'st2::dependency::nginx' do on_supported_os.each do |os, os_facts| let(:facts) do os_facts.merge( @@ -30,4 +30,4 @@ end # context 'with manage_repo=false' end # context 'on #{os}' end # on_supported_os -end # describe 'st2::profile::nginx' +end # describe 'st2::dependency::nginx' diff --git a/spec/classes/profile/web_spec.rb b/spec/classes/profile/web_spec.rb index ae290998..f0469367 100644 --- a/spec/classes/profile/web_spec.rb +++ b/spec/classes/profile/web_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'st2::profile::web' do +describe 'st2::component::web' do on_supported_os.each do |os, os_facts| let(:facts) { os_facts } let(:ssl_dir) { '/etc/ssl/st2' } @@ -40,7 +40,7 @@ context "on #{os}" do context 'with default options' do it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_class('st2::profile::nginx') } + it { is_expected.to contain_class('st2::dependency::nginx') } it do is_expected.to contain_package('st2web') .with(ensure: 'present', diff --git a/templates/etc/profile.d/st2.sh.erb b/templates/etc/profile.d/st2.sh.erb index 7d9792ea..fc2fb1a9 100644 --- a/templates/etc/profile.d/st2.sh.erb +++ b/templates/etc/profile.d/st2.sh.erb @@ -13,3 +13,10 @@ export ST2_AUTH_URL="<%= @auth_url %>" <%- else -%> # export ST2_AUTH_URL="" <%- end -%> + +# URL to the StackStorm stream service (st2stream) +<%- if @stream_url -%> +export ST2_STREAM_URL="<%= @stream_url %>" +<%- else -%> +# export ST2_STREAM_URL="" +<%- end -%> diff --git a/templates/etc/sysconfig/st2sensorcontainer.erb b/templates/etc/sysconfig/st2sensorcontainer.erb new file mode 100644 index 00000000..96b7faf5 --- /dev/null +++ b/templates/etc/sysconfig/st2sensorcontainer.erb @@ -0,0 +1,3 @@ +## This file is maintained by Puppet + +# Add any env variables to inject in the sensor container here \ No newline at end of file