feat: setup/manage dnf-autoupdate
- create service to run dnf update - create timer to call the service - manage settings via params
This commit is contained in:
parent
e0d1ec8926
commit
d8ff9ddb11
18
site/profiles/manifests/yum/autoupdater.pp
Normal file
18
site/profiles/manifests/yum/autoupdater.pp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# profiles::yum::autoupdater
|
||||||
|
#
|
||||||
|
# manage automatic updates for dnf
|
||||||
|
#
|
||||||
|
class profiles::yum::autoupdater (
|
||||||
|
String $on_calendar = '*-*-* 05:00:00',
|
||||||
|
Integer $randomized_delay_sec = 1800,
|
||||||
|
Boolean $enabled = true,
|
||||||
|
) {
|
||||||
|
|
||||||
|
# Ensure the timer is enabled and running
|
||||||
|
systemd::timer { 'dnf-autoupdate.timer':
|
||||||
|
timer_content => template('profiles/yum/autoupdate_timer.erb'),
|
||||||
|
service_content => template('profiles/yum/autoupdate_service.erb'),
|
||||||
|
active => true,
|
||||||
|
enable => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -86,4 +86,8 @@ class profiles::yum::global (
|
|||||||
class { 'profiles::yum::puppet7':
|
class { 'profiles::yum::puppet7':
|
||||||
managed_repos => $managed_repos,
|
managed_repos => $managed_repos,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# setup dnf-autoupdate
|
||||||
|
include profiles::yum::autoupdater
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
6
site/profiles/templates/yum/autoupdate_service.erb
Normal file
6
site/profiles/templates/yum/autoupdate_service.erb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=dnf-autoupdater-service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/bin/dnf update -y
|
||||||
10
site/profiles/templates/yum/autoupdate_timer.erb
Normal file
10
site/profiles/templates/yum/autoupdate_timer.erb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=dnf-autoupdater-timer
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=<%= @on_calendar %>
|
||||||
|
RandomizedDelaySec=<%= @randomized_delay_sec %>
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
Loading…
Reference in New Issue
Block a user