Skip to content

Commit

Permalink
Add conditional checking on ubuntu kernel unattended_upgrades disabli…
Browse files Browse the repository at this point in the history
…ng (kubernetes-sigs#11479)

Signed-off-by: tu1h <lihai.tu@daocloud.io>
  • Loading branch information
0ekk authored and kpoxo6op committed Dec 27, 2024
1 parent 6ea595f commit ad2035c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion roles/bootstrap-os/tasks/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,22 @@
- '"value from" in bootstrap_update_apt_result.stdout'
ignore_errors: true

- name: Check unattended-upgrades file exist
stat:
path: /etc/apt/apt.conf.d/50unattended-upgrades
register: unattended_upgrades_file_stat
when:
- os_release_dict['ID'] == 'ubuntu'
- ubuntu_kernel_unattended_upgrades_disabled

- name: Disable kernel unattended-upgrades
lineinfile:
path: /etc/apt/apt.conf.d/50unattended-upgrades
path: "{{ unattended_upgrades_file_stat.stat.path }}"
insertafter: "Unattended-Upgrade::Package-Blacklist"
line: '"linux-";'
state: present
become: true
when:
- os_release_dict['ID'] == 'ubuntu'
- ubuntu_kernel_unattended_upgrades_disabled
- unattended_upgrades_file_stat.stat.exists

0 comments on commit ad2035c

Please sign in to comment.