update state
This commit is contained in:
@@ -13,13 +13,23 @@
|
||||
vars:
|
||||
os_update_version_codename: "{{ new_version_codename }}" # Variable gets passed by main.yml task
|
||||
|
||||
- name: Update additional repositories in /etc/apt/sources.list.d
|
||||
- name: Update additional repositories in /etc/apt/sources.list.d (deb822 format)
|
||||
replace:
|
||||
path: "{{ item }}"
|
||||
regexp: '^(Suites:.*\s)({{ os_update_version_codename }})(\s|$)'
|
||||
replace: '\1{{ new_version_codename }}\3'
|
||||
loop: "{{ lookup('ansible.builtin.fileglob', '/etc/apt/sources.list.d/*.sources') }}"
|
||||
when: item | file
|
||||
ignore_errors: true
|
||||
|
||||
- name: Update additional repositories in /etc/apt/sources.list.d (old format fallback)
|
||||
lineinfile:
|
||||
path: "{{ item }}"
|
||||
regexp: '^(deb .* )({{ os_update_version_codename }})'
|
||||
line: '\1{{ new_version_codename }}'
|
||||
replace: '\1{{ new_version_codename }}'
|
||||
loop: "{{ lookup('ansible.builtin.fileglob', '/etc/apt/sources.list.d/*.list') }}"
|
||||
when: item | file
|
||||
ignore_errors: true
|
||||
|
||||
- name: Update apt cache
|
||||
apt:
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
remote_src: yes
|
||||
force: yes
|
||||
|
||||
- name: Remove existing debian.sources file from LXC image
|
||||
file:
|
||||
path: /etc/apt/sources.list.d/debian.sources
|
||||
state: absent
|
||||
|
||||
- name: Update sources.list with new mirrors
|
||||
template:
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
shell: |
|
||||
dpkg -l | grep -E '^ii' | grep 'linux-image-[0-9]' | awk '{print $2}' | sort | tail -n 1
|
||||
register: latest_kernel
|
||||
when: ansible_virtualization_type != 'lxc'
|
||||
|
||||
- name: Check if running kernel matches the latest installed kernel
|
||||
shell: |
|
||||
@@ -16,8 +17,11 @@
|
||||
register: kernel_match
|
||||
changed_when: false
|
||||
ignore_errors: true
|
||||
when: ansible_virtualization_type != 'lxc'
|
||||
|
||||
- name: Mark reboot required if a new kernel is installed
|
||||
set_fact:
|
||||
reboot_required: "yes"
|
||||
when: kernel_match.stdout == "0"
|
||||
when:
|
||||
- ansible_virtualization_type != 'lxc'
|
||||
- kernel_match.stdout == "0"
|
||||
Reference in New Issue
Block a user