From 06fa35b7f84be2d6074278cfa8bd48d394022bea Mon Sep 17 00:00:00 2001 From: Arne Teuke Date: Tue, 3 Jun 2025 17:01:11 +0200 Subject: [PATCH] config file --- manifests/params.pp | 19 ++++++++++++++++--- templates/automatic.conf.erb | 16 ++++++++-------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 929117b..a797a30 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -5,14 +5,27 @@ # @param [String] reqpackages which packages to install # @param [String] pkg_ensure which version of packages to install # @param [String] ac_upgrade_type what upgrades to manage +# @param [String] ac_random_sleep random sleep seconds +# @param [String] ac_network_online_timeout Maximum time until be online +# @param [String] ac_download_updates whether to download available updates +# @param [String] ac_apply_updates whether to apply available updates +# @param [String] ac_reboot when to reboot after applied updates +# @param [String] ac_emit_via how to inform about emitted updates ############################################################################## class automatic_cd::params ( - String $reqpackages = 'dnf-automatic', - String $pkg_ensure = 'latest', + String $reqpackages = 'dnf-automatic', + String $pkg_ensure = 'latest', # updates - String $ac_upgrade_type = 'default', + String $ac_upgrade_type = 'default', + String $ac_random_sleep = '0', + String $ac_network_online_timeout = '60', + String $ac_download_updates = 'yes', + String $ac_apply_updates = 'yes', + String $ac_reboot = 'never', + String $ac_emit_via = 'email', + ) { # Facts diff --git a/templates/automatic.conf.erb b/templates/automatic.conf.erb index fb62500..fe3abdd 100644 --- a/templates/automatic.conf.erb +++ b/templates/automatic.conf.erb @@ -5,30 +5,30 @@ # What kind of upgrade to perform: # default = all available upgrades # security = only the security upgrades -upgrade_type = default -random_sleep = 0 +upgrade_type = <%= @ac_upgrade_type %> +random_sleep = <%= @ac_random_sleep %> # Maximum time in seconds to wait until the system is on-line and able to # connect to remote repositories. -network_online_timeout = 60 +network_online_timeout = <%= @ac_network_online_timeout %> # To just receive updates use dnf-automatic-notifyonly.timer # Whether updates should be downloaded when they are available, by # dnf-automatic.timer. notifyonly.timer, download.timer and # install.timer override this setting. -download_updates = yes +download_updates = <%= @ac_download_updates %> # Whether updates should be applied when they are available, by # dnf-automatic.timer. notifyonly.timer, download.timer and # install.timer override this setting. -apply_updates = no +apply_updates = <%= @ac_apply_updates %> # When the system should reboot following upgrades: # never = don't reboot after upgrades # when-changed = reboot after any changes # when-needed = reboot when necessary to apply changes -reboot = never +reboot = <%= @ac_reboot %> # The command that is run to trigger a system reboot. reboot_command = "shutdown -r +5 'Rebooting after applying package updates'" @@ -48,12 +48,12 @@ reboot_command = "shutdown -r +5 'Rebooting after applying package updates'" # command compatible with sendmail. # Default is email,stdio. # If emit_via is None or left blank, no messages will be sent. -emit_via = stdio +emit_via = <%= @ac_emit_via %> [email] # The address to send email messages from. -email_from = root@example.com +email_from = root@<%= @qfqdn %> # List of addresses to send messages to. email_to = root