-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathutils-debian11to12.yml
41 lines (40 loc) · 1.54 KB
/
utils-debian11to12.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
- name: check if host is already running the target distribution
debug:
msg: "Host is already running Debian 12. Nothing to do."
when: ansible_facts.distribution_release == "bookworm"
- name: upgrade Debian 11 to 12
when: ansible_facts.distribution_release == "bullseye"
block:
- name: update apt cache
apt:
update_cache: yes
- name: upgrade all packages to latest versions (safe-upgrade) # noqa no-changed-when command-instead-of-module
command:
cmd: apt-get -y upgrade
environment:
DEBIAN_FRONTEND: noninteractive
- name: list APT sources configuration files
find:
path: /etc/apt/sources.list.d/
patterns: '*.list'
register: common_apt_sources_files
- name: replace bullseye with bookworm in APT sources list
replace:
path: "{{ item }}"
regexp: "bullseye"
replace: "bookworm"
with_items: "{{ common_apt_sources_files.files | map(attribute='path') | list + ['/etc/apt/sources.list'] }}"
- name: update apt cache
apt:
update_cache: yes
- name: upgrade all packages to latest versions (dist-upgrade) # noqa no-changed-when command-instead-of-module
command:
cmd: apt-get -y dist-upgrade
environment:
DEBIAN_FRONTEND: noninteractive
- name: reboot host
reboot:
reboot_timeout: 6000
- name: show upgrade completion message
debug:
msg: "Upgrade to Debian 12 complete. Please run the playbook against this host to apply up-to-date configuration for Debian 12."