From 2bc5d9a1aa0f8218e6bcab6418e9d77247576b74 Mon Sep 17 00:00:00 2001 From: Arne Teuke Date: Mon, 2 Jun 2025 17:03:06 +0200 Subject: [PATCH] add basic structure --- .vscode/settings.json | 7 +++ manifests/main/config.pp | 4 +- manifests/main/dirs.pp | 10 ++++ manifests/main/files.pp | 10 ++++ manifests/main/install.pp | 2 +- manifests/main/service.pp | 17 +++++++ manifests/params.pp | 11 +++- templates/automatic.conf.erb | 97 ++++++++++++++++++++++++++++++++++++ 8 files changed, 154 insertions(+), 4 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 manifests/main/dirs.pp create mode 100644 manifests/main/files.pp create mode 100644 manifests/main/service.pp create mode 100644 templates/automatic.conf.erb diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..15d16a0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "cSpell.words": [ + "debuglevel", + "notifyonly", + "Ssendwait" + ] +} \ No newline at end of file diff --git a/manifests/main/config.pp b/manifests/main/config.pp index 20bc9fc..2078108 100644 --- a/manifests/main/config.pp +++ b/manifests/main/config.pp @@ -1,4 +1,4 @@ -## automatic_cd::config.pp +## automatic_cd::main::config.pp # Module name: automatic_cd # Author: Arne Teuke (arne_teuke@confdroid.com) # @summary Class manages module logic for the automatic_cd module @@ -6,5 +6,5 @@ class automatic_cd::main::config ( ) inherits automatic_cd::params { - include automatic_cd::main::install + include automatic_cd::main::service } diff --git a/manifests/main/dirs.pp b/manifests/main/dirs.pp new file mode 100644 index 0000000..98493a2 --- /dev/null +++ b/manifests/main/dirs.pp @@ -0,0 +1,10 @@ +## automatic_cd::main::dirs.pp +# Module name: automatic_cd +# Author: Arne Teuke (arne_teuke@confdroid.com) +# @summary Class manages dirs for the automatic_cd module +############################################################################## +class automatic_cd::main::dirs ( + +) inherits automatic_cd::params { + require automatic_cd::main::install +} diff --git a/manifests/main/files.pp b/manifests/main/files.pp new file mode 100644 index 0000000..6269572 --- /dev/null +++ b/manifests/main/files.pp @@ -0,0 +1,10 @@ +## automatic_cd::main::files.pp +# Module name: automatic_cd +# Author: Arne Teuke (arne_teuke@confdroid.com) +# @summary Class manages files for the automatic_cd module +############################################################################## +class automatic_cd::main::files ( + +) inherits automatic_cd::params { + require automatic_cd::main::dirs +} diff --git a/manifests/main/install.pp b/manifests/main/install.pp index e967a06..aeae542 100644 --- a/manifests/main/install.pp +++ b/manifests/main/install.pp @@ -1,4 +1,4 @@ -## automatic_cd::install.pp +## automatic_cd::main::install.pp # Module name: automatic_cd # Author: Arne Teuke (arne_teuke@confdroid.com) # @summary Class manages installation section for the automatic_cd module diff --git a/manifests/main/service.pp b/manifests/main/service.pp new file mode 100644 index 0000000..adb37e5 --- /dev/null +++ b/manifests/main/service.pp @@ -0,0 +1,17 @@ +## automatic_cd::main::service.pp +# Module name: automatic_cd +# Author: Arne Teuke (arne_teuke@confdroid.com) +# @summary Class manages services for the automatic_cd module +############################################################################## +class automatic_cd::main::service ( + +) inherits automatic_cd::params { + require automatic_cd::main::files + + service { $ac_service: + ensure => running, + hasstatus => true, + hasrestart => true, + enable => true, + } +} diff --git a/manifests/params.pp b/manifests/params.pp index 1269fdb..3ff5751 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -8,9 +8,18 @@ class automatic_cd::params ( String $reqpackages = 'dnf-automatic', - String $pkg_ensure = 'latest', + String $pkg_ensure = 'latest', ) { +# Facts + $fqdn = $facts['networking']['fqdn'] + $domain = $facts['networking']['domain'] + $os_name = $facts['os']['name'] + $os_release = $facts['os']['release']['major'] + +# Service + $ac_service = 'dnf-automatic.timer' + # includes must be last include automatic_cd::main::config } diff --git a/templates/automatic.conf.erb b/templates/automatic.conf.erb new file mode 100644 index 0000000..fb62500 --- /dev/null +++ b/templates/automatic.conf.erb @@ -0,0 +1,97 @@ +############################################################################### +### automatic.conf managed by Puppet. Manual changes will be overwritten! ### +############################################################################### +[commands] +# What kind of upgrade to perform: +# default = all available upgrades +# security = only the security upgrades +upgrade_type = default +random_sleep = 0 + +# Maximum time in seconds to wait until the system is on-line and able to +# connect to remote repositories. +network_online_timeout = 60 + +# 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 + +# 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 + +# 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 + +# The command that is run to trigger a system reboot. +reboot_command = "shutdown -r +5 'Rebooting after applying package updates'" + + +[emitters] +# Name to use for this system in messages that are emitted. Default is the +# hostname. +# system_name = my-host + +# How to send messages. Valid options are stdio, email and motd. If +# emit_via includes stdio, messages will be sent to stdout; this is useful +# to have cron send the messages. If emit_via includes email, this +# program will send email itself according to the configured options. +# If emit_via includes motd, /etc/motd file will have the messages. if +# emit_via includes command_email, then messages will be send via a shell +# command compatible with sendmail. +# Default is email,stdio. +# If emit_via is None or left blank, no messages will be sent. +emit_via = stdio + + +[email] +# The address to send email messages from. +email_from = root@example.com + +# List of addresses to send messages to. +email_to = root + +# Name of the host to connect to to send email messages. +email_host = localhost + + +[command] +# The shell command to execute. This is a Python format string, as used in +# str.format(). The format function will pass a shell-quoted argument called +# `body`. +# command_format = "cat" + +# The contents of stdin to pass to the command. It is a format string with the +# same arguments as `command_format`. +# stdin_format = "{body}" + + +[command_email] +# The shell command to use to send email. This is a Python format string, +# as used in str.format(). The format function will pass shell-quoted arguments +# called body, subject, email_from, email_to. +# command_format = "mail -Ssendwait -s {subject} -r {email_from} {email_to}" + +# The contents of stdin to pass to the command. It is a format string with the +# same arguments as `command_format`. +# stdin_format = "{body}" + +# The address to send email messages from. +email_from = root@example.com + +# List of addresses to send messages to. +email_to = root + + +[base] +# This section overrides dnf.conf + +# Use this to filter DNF core messages +debuglevel = 1