From 8bb7f28b546793f567fc2194723990310dd4c8b1 Mon Sep 17 00:00:00 2001 From: "Vogt, Jonathan" Date: Mon, 7 Dec 2015 15:28:32 +0100 Subject: [PATCH 1/2] Make template overwriteable --- README.md | 23 +++++++++++++---------- manifests/init.pp | 28 +++++++++++++++------------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index ac77552..f0a25e4 100644 --- a/README.md +++ b/README.md @@ -55,16 +55,19 @@ The simplest use of this module is: This module has one class, `unattended_upgrades`, with the following parameters: - $period = 1, # Update period (in days) - $repos = {}, # Repos to upgrade - defaults to empty. - $blacklist = [], # Packages to not update - $email = '', # Email for update status - $autofix = true, # Ensure updates keep getting installed - $minimal_steps = true, # Allows for shutdown during an upgrade - $on_shutdown = false, # Install only on shutdown - $on_error = false, # Email only on errors, else always - $autoremove = false, # Automatically remove unused dependencies - $auto_reboot = false, # Automatically reboot if needed + $period = 1, # Update period (in days) + $repos = {}, # Repos to upgrade + $blacklist = [], # Packages to not update + $email = '', # Email for update status + $autofix = true, # Ensure updates keep getting ins + $minimal_steps = true, # Allows for shutdown during an u + $on_shutdown = false, # Install only on shutdown + $on_error = false, # Email only on errors, else alwa + $autoremove = false, # Automatically remove unused dep + $auto_reboot = false, # Automatically reboot if needed + $template_unattended_upgrades = 'unattended-upgrades/unattended-upgrades.erb', # Path to config template + $template_auto_upgrades = 'unattended-upgrades/auto-upgrades.erb', # Path to apt config template + Logs are at the usual `/var/log/unattended-upgrades`, and emails will be automatically sent if an email is given. diff --git a/manifests/init.pp b/manifests/init.pp index da4e04a..bd5ed0e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,14 +1,16 @@ class unattended_upgrades( - $period = 1, # Update period (in days) - $repos = {}, # Repos to upgrade - $blacklist = [], # Packages to not update - $email = '', # Email for update status - $autofix = true, # Ensure updates keep getting installed - $minimal_steps = true, # Allows for shutdown during an upgrade - $on_shutdown = false, # Install only on shutdown - $on_error = false, # Email only on errors, else always - $autoremove = false, # Automatically remove unused dependencies - $auto_reboot = false, # Automatically reboot if needed + $period = 1, # Update period (in days) + $repos = {}, # Repos to upgrade + $blacklist = [], # Packages to not update + $email = '', # Email for update status + $autofix = true, # Ensure updates keep getting installed + $minimal_steps = true, # Allows for shutdown during an upgrade + $on_shutdown = false, # Install only on shutdown + $on_error = false, # Email only on errors, else always + $autoremove = false, # Automatically remove unused dependencies + $auto_reboot = false, # Automatically reboot if needed + $template_unattended_upgrades = 'unattended-upgrades/unattended-upgrades.erb', # Path to config template + $template_auto_upgrades = 'unattended-upgrades/auto-upgrades.erb', # Path to apt config template ) { $conf_path = '/etc/apt/apt.conf.d/50unattended-upgrades' @@ -22,13 +24,13 @@ package { $package: ensure => latest, } - + file { $conf_path: ensure => file, owner => root, group => root, mode => '0644', - content => template('unattended_upgrades/unattended-upgrades.erb'), + content => template($template_unattended_upgrades), } file { $apt_path: @@ -36,7 +38,7 @@ owner => root, group => root, mode => '0644', - content => template('unattended_upgrades/auto-upgrades.erb') + content => template($template_auto_upgrades) } service { $package: From f334daf2f2c90f697eca7ce2db72e03e2f0c64e1 Mon Sep 17 00:00:00 2001 From: "Vogt, Jonathan" Date: Mon, 7 Dec 2015 16:00:11 +0100 Subject: [PATCH 2/2] Fix Path in Template --- README.md | 4 ++-- manifests/init.pp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f0a25e4..fe722a4 100644 --- a/README.md +++ b/README.md @@ -65,8 +65,8 @@ parameters: $on_error = false, # Email only on errors, else alwa $autoremove = false, # Automatically remove unused dep $auto_reboot = false, # Automatically reboot if needed - $template_unattended_upgrades = 'unattended-upgrades/unattended-upgrades.erb', # Path to config template - $template_auto_upgrades = 'unattended-upgrades/auto-upgrades.erb', # Path to apt config template + $template_unattended_upgrades = 'unattended_upgrades/unattended-upgrades.erb', # Path to config template + $template_auto_upgrades = 'unattended_upgrades/auto-upgrades.erb', # Path to apt config template Logs are at the usual `/var/log/unattended-upgrades`, and emails will diff --git a/manifests/init.pp b/manifests/init.pp index bd5ed0e..a5dcb89 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -9,8 +9,8 @@ $on_error = false, # Email only on errors, else always $autoremove = false, # Automatically remove unused dependencies $auto_reboot = false, # Automatically reboot if needed - $template_unattended_upgrades = 'unattended-upgrades/unattended-upgrades.erb', # Path to config template - $template_auto_upgrades = 'unattended-upgrades/auto-upgrades.erb', # Path to apt config template + $template_unattended_upgrades = 'unattended_upgrades/unattended-upgrades.erb', # Path to config template + $template_auto_upgrades = 'unattended_upgrades/auto-upgrades.erb', # Path to apt config template ) { $conf_path = '/etc/apt/apt.conf.d/50unattended-upgrades'