From fccc58852094a471c780e75027bab0d855f90a22 Mon Sep 17 00:00:00 2001 From: Barbz Date: Mon, 21 May 2018 14:05:38 +0200 Subject: [PATCH] Add unattended_dl_limit variable to limit bandwidth (#51) --- README.md | 2 ++ defaults/main.yml | 4 ++++ templates/unattended-upgrades.j2 | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c506473..e30e37b 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,8 @@ On some hosts you may find that the unattended-upgrade's cronfile `/etc/cron.dai * Default: `1800` (30 minutes) * `unattended_dpkg_options`: Array of dpkg command-line options used during unattended-upgrades runs, e.g. `["--force-confdef"]`, `["--force-confold"]` * Default: `[]` +* `unattended_dl_limit`: Limit the download speed in kb/sec using apt bandwidth limit feature. + * Default: disabled ## Origins Patterns diff --git a/defaults/main.yml b/defaults/main.yml index e233b39..7b2a211 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -116,3 +116,7 @@ unattended_dpkg_options: [] # unattended_dpkg_options: # - "--force-confdef" # - "--force-confold" + + +# Use apt bandwidth limit feature, this example limits the download speed to 70kb/sec +#unattended_dl_limit: 70 \ No newline at end of file diff --git a/templates/unattended-upgrades.j2 b/templates/unattended-upgrades.j2 index f0a12e2..d66b4e5 100644 --- a/templates/unattended-upgrades.j2 +++ b/templates/unattended-upgrades.j2 @@ -90,6 +90,8 @@ Dpkg::Options { }; {% endif %} +{% if unattended_dl_limit is defined %} // Use apt bandwidth limit feature, this example limits the download // speed to 70kb/sec -//Acquire::http::Dl-Limit "70"; +Acquire::http::Dl-Limit "{{ unattended_dl_limit }}"; +{% endif %}