-
Notifications
You must be signed in to change notification settings - Fork 696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Makes unattended-upgrades sequencing more similar to cron-apt #5855
Changes from 5 commits
a98e91c
34fdc7a
bddeb5e
a083a52
1bc7452
b349d71
74fadb8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,7 @@ | |
- name: update apt cache | ||
apt: | ||
update_cache: yes | ||
|
||
- name: systemd daemon-reload | ||
systemd: | ||
daemon_reload: yes |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,24 @@ | |
# Configuration for unattended upgrades is almost exclusively managed by the | ||
# securedrop-config package under Focal. | ||
|
||
- name: Create override dirs for apt-daily timers | ||
file: | ||
state: directory | ||
mode: "0755" | ||
path: "{{ item.dest|dirname }}" | ||
with_items: "{{ unattended_upgrades_timer_overrides }}" | ||
|
||
- name: Add overrides for apt-daily timers | ||
template: | ||
src: "{{ item.src }}" | ||
dest: "{{ item.dest }}" | ||
mode: "0644" | ||
notify: systemd daemon-reload | ||
with_items: "{{ unattended_upgrades_timer_overrides }}" | ||
|
||
# Ensure daemon-reload has happened before starting/enabling | ||
- meta: flush_handlers | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
- name: Ensure apt-daily and apt-daily-upgrade services are unmasked, started and enabled. | ||
systemd: | ||
name: "{{ item }}" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
{% if ansible_distribution_release == "focal" %} | ||
// If automatic reboot is enabled and needed, reboot at the specific | ||
// time instead of immediately | ||
// Default: "now" | ||
Unattended-Upgrade::Automatic-Reboot-Time "{{ daily_reboot_time }}:00"; | ||
// Reboot should happen after nightly upgrades. Timing of upgrade | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since we are no longer templating this file (using the reboot time) we could move this configuration to 50unattended-upgrades for simplicity There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, I can move that logic back to the Focal-specific config package now. |
||
// is configured via apt.daily.timer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo in comment: |
||
Unattended-Upgrade::Automatic-Reboot-Time "now"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Warning: my understanding of this option is that running There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for calling this out. If we can confirm this behavior & the PR lands, I'll add a small note the docs to this effect. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even though I can see the timers getting fired, the systems did not reboot. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To guarantee a reboot, we'd have to update the reboot-flag to fire perhaps hourly. Right now, it fires once every 12 hours. So it's likely that when the update ran, |
||
{% endif %} | ||
// Don't install packages from "Recommends" field, we'll manage dependencies | ||
// explicitly to avoid pulling in packages from e.g. universe. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[Timer] | ||
OnCalendar= | ||
OnCalendar=*-*-* {{ (daily_reboot_time|int - 1) % 24 }}:00 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The goal of this modulus is to ensure that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This works on the staging instance. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Running the update more frequently would increase the chance of applying upgrades as soon as possible. You could update every hour except the one in which upgrade is performed with:
|
||
RandomizedDelaySec=20m | ||
Persistent=true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[Timer] | ||
OnCalendar= | ||
OnCalendar=*-*-* {{ daily_reboot_time }}:00 | ||
RandomizedDelaySec=20m |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,5 +62,7 @@ Unattended-Upgrade::Automatic-Reboot-WithUsers "true"; | |
// Here we set the dpkg options to force the old conffile if it's already present | ||
// or force the default config if no config is present | ||
// see https://github.com/freedomofpress/securedrop/pull/911 | ||
Dpkg::Options "force-confdef"; | ||
Dpkg::Options "force-confold"; | ||
Dpkg::Options { | ||
"--force-confdef"; | ||
"--force-confold"; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's the change that will re-close #5849. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially i thought this was a template block but it's just declaring the variables 👍