From 7c22f2b689cace7efa17d81b2c461d011e9ff153 Mon Sep 17 00:00:00 2001 From: Joris29 Date: Wed, 13 Mar 2024 09:47:02 +0100 Subject: [PATCH 1/3] Fix job loop and add ensure parameter to job type --- manifests/config/project.pp | 14 +++++++------- spec/defines/config/project_spec.rb | 11 +++++++++++ types/job.pp | 5 +++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/manifests/config/project.pp b/manifests/config/project.pp index 3685ea59..98fdabb3 100644 --- a/manifests/config/project.pp +++ b/manifests/config/project.pp @@ -72,13 +72,13 @@ environment => $rundeck::cli::environment, onlyif => "rd jobs list -p '${name}' -J '${_name}' | grep -q '${_name}'", } - } - - exec { "Create/update rundeck job: ${_name}": - command => "rd jobs load -d update -p '${name}' -f '${_attr['path']}' -F ${_attr['format']}", - path => ['/bin', '/usr/bin', '/usr/local/bin'], - environment => $rundeck::cli::environment, - unless => "rd_job_diff.sh '${name}' '${_name}' '${_attr['path']}' ${_attr['format']}", + } else { + exec { "Create/update rundeck job: ${_name}": + command => "rd jobs load -d update -p '${name}' -f '${_attr['path']}' -F ${_attr['format']}", + path => ['/bin', '/usr/bin', '/usr/local/bin'], + environment => $rundeck::cli::environment, + unless => "rd_job_diff.sh '${name}' '${_name}' '${_attr['path']}' ${_attr['format']}", + } } } } diff --git a/spec/defines/config/project_spec.rb b/spec/defines/config/project_spec.rb index de0a19b5..9de28ef0 100644 --- a/spec/defines/config/project_spec.rb +++ b/spec/defines/config/project_spec.rb @@ -87,6 +87,11 @@ 'path' => '/etc/testjob1', 'format' => 'yaml', }, + 'DeleteJob1' => { + 'ensure' => 'absent', + 'path' => '/etc/testjob1', + 'format' => 'yaml', + }, }, } end @@ -110,6 +115,11 @@ 'TestJob1' => { 'path' => '/etc/testjob1', 'format' => 'yaml', + }, + 'DeleteJob1' => { + 'ensure' => 'absent', + 'path' => '/etc/testjob1', + 'format' => 'yaml', } } ) @@ -120,6 +130,7 @@ it { is_expected.to contain_exec('Create/update rundeck job: MyJob1') } it { is_expected.to contain_exec('Create/update rundeck job: MyJob2') } it { is_expected.to contain_exec('Create/update rundeck job: TestJob1') } + it { is_expected.to contain_exec('Remove rundeck job: DeleteJob1') } end end end diff --git a/types/job.pp b/types/job.pp index be57febe..8851f622 100644 --- a/types/job.pp +++ b/types/job.pp @@ -1,5 +1,6 @@ # @summary Rundeck job type. type Rundeck::Job = Struct[{ - 'path' => Stdlib::Absolutepath, - 'format' => Enum['yaml', 'xml', 'json'], + 'path' => Stdlib::Absolutepath, + 'format' => Enum['yaml', 'xml', 'json'], + Optional['ensure'] => Enum['absent', 'present'], }] From 71f2500d83083f2ebc24529b210f9a4315877e8c Mon Sep 17 00:00:00 2001 From: Joris29 Date: Wed, 13 Mar 2024 10:06:46 +0100 Subject: [PATCH 2/3] Add more log levels --- manifests/init.pp | 12 ++++++++++++ templates/log4j2.properties.epp | 12 ++++++------ templates/rundeck-config.properties.epp | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index aa71a463..929c278a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -65,10 +65,18 @@ # An array with hashes of properties for customizing the [Rundeck Key Storage](https://docs.rundeck.com/docs/manual/key-storage/key-storage.html) # @param key_storage_encrypt_config # An array with hashes of properties for customizing the [Rundeck Key Storage converter](https://docs.rundeck.com/docs/administration/configuration/plugins/configuring.html#storage-converter-plugins) +# @param root_log_level +# The log4j root logging level to be set for Rundeck. # @param app_log_level # The log4j logging level to be set for the Rundeck application. # @param audit_log_level # The log4j logging level to be set for the Rundeck autorization. +# @param webhook_plugins_log_level +# The log4j logging level to be set for the Rundeck plugin webhooks. +# @param execution_cleanup_log_level +# The log4j logging level to be set for the Rundeck execution cleanup. +# @param jaas_log_level +# The log4j logging level to be set for the Rundeck jaas security. # @param config_template # The template used for rundeck-config properties. Needs to be in epp format. # @param override_template @@ -216,8 +224,12 @@ Hash $preauthenticated_config = {}, Rundeck::Key_storage_config $key_storage_config = [{ 'type' => 'db', 'path' => 'keys' }], Array[Hash] $key_storage_encrypt_config = [], + Rundeck::Loglevel $root_log_level = 'info', Rundeck::Loglevel $app_log_level = 'info', Rundeck::Loglevel $audit_log_level = 'info', + Rundeck::Loglevel $webhook_plugins_log_level = 'info', + Rundeck::Loglevel $execution_cleanup_log_level = 'info', + Rundeck::Loglevel $jaas_log_level = 'info', String[1] $config_template = 'rundeck/rundeck-config.properties.epp', String[1] $override_template = 'rundeck/profile_overrides.epp', String[1] $realm_template = 'rundeck/realm.properties.epp', diff --git a/templates/log4j2.properties.epp b/templates/log4j2.properties.epp index 70ec0923..07994e00 100644 --- a/templates/log4j2.properties.epp +++ b/templates/log4j2.properties.epp @@ -143,7 +143,7 @@ appender.webhooks.policies.type = Policies appender.webhooks.policies.time.type = TimeBasedTriggeringPolicy appender.webhooks.policies.time.interval = 1 -rootLogger.level = warn +rootLogger.level = <%= $rundeck::root_log_level %> rootLogger.appenderRef.stdout.ref = STDOUT rootLogger.appenderRef.rundeck.ref = rundeck @@ -223,12 +223,12 @@ logger.webhook_events.additivity = false logger.webhook_events.appenderRef.webhooks.ref = webhooks logger.webhook_plugins.name = org.rundeck.plugin.webhook -logger.webhook_plugins.level = debug +logger.webhook_plugins.level = <%= $rundeck::webhook_plugins_log_level %> logger.webhook_plugins.additivity = false logger.webhook_plugins.appenderRef.webhooks.ref = webhooks logger.cleanup.name = rundeck.quartzjobs.ExecutionsCleanUp -logger.cleanup.level = debug +logger.cleanup.level = <%= $rundeck::execution_cleanup_log_level %> logger.cleanup.additivity = false logger.cleanup.appenderRef.cleanup.ref = cleanup @@ -243,17 +243,17 @@ logger.hibernate.additivity = false logger.hibernate.appenderRef.stdout.ref = STDOUT logger.rundeck_jaas.name = com.dtolabs.rundeck.jetty.jaas -logger.rundeck_jaas.level = debug +logger.rundeck_jaas.level = <%= $rundeck::jaas_log_level %> logger.rundeck_jaas.additivity = false logger.rundeck_jaas.appenderRef.stdout.ref = STDOUT logger.spring_security.name = grails.plugin.springsecurity.web.authentication.GrailsUsernamePasswordAuthenticationFilter -logger.spring_security.level = debug +logger.spring_security.level = <%= $rundeck::jaas_log_level %> logger.spring_security.additivity = false logger.spring_security.appenderRef.stdout.ref = STDOUT logger.jaas.name = org.rundeck.jaas -logger.jaas.level = debug +logger.jaas.level = <%= $rundeck::jaas_log_level %> logger.jaas.additivity = false logger.jaas.appenderRef.stdout.ref = STDOUT diff --git a/templates/rundeck-config.properties.epp b/templates/rundeck-config.properties.epp index 6e013072..419eabe7 100644 --- a/templates/rundeck-config.properties.epp +++ b/templates/rundeck-config.properties.epp @@ -1,4 +1,4 @@ -loglevel.default = <%= $rundeck::app_log_level %> +loglevel.default = <%= $rundeck::root_log_level %> rdeck.base = <%= $rundeck::config::base_dir %> rss.enabled = <%= $rundeck::rss_enabled %> From 10ef2fa8be33c528d56787d81c2e7f66544812bd Mon Sep 17 00:00:00 2001 From: Joris29 Date: Wed, 13 Mar 2024 10:07:11 +0100 Subject: [PATCH 3/3] Update documentation --- REFERENCE.md | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 32877add..d5908b8d 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -81,8 +81,12 @@ The following parameters are available in the `rundeck` class: * [`preauthenticated_config`](#-rundeck--preauthenticated_config) * [`key_storage_config`](#-rundeck--key_storage_config) * [`key_storage_encrypt_config`](#-rundeck--key_storage_encrypt_config) +* [`root_log_level`](#-rundeck--root_log_level) * [`app_log_level`](#-rundeck--app_log_level) * [`audit_log_level`](#-rundeck--audit_log_level) +* [`webhook_plugins_log_level`](#-rundeck--webhook_plugins_log_level) +* [`execution_cleanup_log_level`](#-rundeck--execution_cleanup_log_level) +* [`jaas_log_level`](#-rundeck--jaas_log_level) * [`config_template`](#-rundeck--config_template) * [`override_template`](#-rundeck--override_template) * [`realm_template`](#-rundeck--realm_template) @@ -430,6 +434,14 @@ An array with hashes of properties for customizing the [Rundeck Key Storage conv Default value: `[]` +##### `root_log_level` + +Data type: `Rundeck::Loglevel` + +The log4j root logging level to be set for Rundeck. + +Default value: `'info'` + ##### `app_log_level` Data type: `Rundeck::Loglevel` @@ -446,6 +458,30 @@ The log4j logging level to be set for the Rundeck autorization. Default value: `'info'` +##### `webhook_plugins_log_level` + +Data type: `Rundeck::Loglevel` + +The log4j logging level to be set for the Rundeck plugin webhooks. + +Default value: `'info'` + +##### `execution_cleanup_log_level` + +Data type: `Rundeck::Loglevel` + +The log4j logging level to be set for the Rundeck execution cleanup. + +Default value: `'info'` + +##### `jaas_log_level` + +Data type: `Rundeck::Loglevel` + +The log4j logging level to be set for the Rundeck jaas security. + +Default value: `'info'` + ##### `config_template` Data type: `String[1]` @@ -1065,8 +1101,9 @@ Alias of ```puppet Struct[{ - 'path' => Stdlib::Absolutepath, - 'format' => Enum['yaml', 'xml', 'json'], + 'path' => Stdlib::Absolutepath, + 'format' => Enum['yaml', 'xml', 'json'], + Optional['ensure'] => Enum['absent', 'present'], }] ```