Skip to content

Commit bcea53d

Browse files
committed
bringup: devconfig: fix python3-apt debian issue
Downgrade python3-apt package to 2.9.6 during bringup to avoid Ansible error with apt module (see below). Build from source python3-apt using pip, and lock any possible future upgrades of the package to avoid overwriting the build from source deployment. This is a workaround until python3-apt package in Debian testing is fixed. It will also delay the bringup process considerably depending on the guest. The latest python3-apt releases 2.9.8 and 2.9.7 produces the following error with Ansible: Error message: TASK [create_partition : Install partition creation base tools] fatal: [4da8c43-xfs-reflink-4k]: FAILED! => { "changed": false } MSG: python3-apt must be installed and visible from /usr/bin/python3. Tested with Ansible version: ii ansible 9.5.1+dfsg-1 all ii ansible-core 2.17.1-1 ansible --version ansible [core 2.17.1] ... python version = 3.12.6 (main, Sep 7 2024, 14:20:15) [GCC 14.2.0] (/usr/bin/python3) jinja version = 3.1.3 libyaml = True ansible-playbook --version ansible-playbook [core 2.17.1] ... executable location = /usr/bin/ansible-playbook python version = 3.12.6 (main, Sep 7 2024, 14:20:15) [GCC 14.2.0] (/usr/bin/python3) jinja version = 3.1.3 libyaml = True Signed-off-by: Daniel Gomez <[email protected]>
1 parent 3d4cf5c commit bcea53d

File tree

1 file changed

+48
-0
lines changed
  • playbooks/roles/devconfig/tasks/install-deps/debian

1 file changed

+48
-0
lines changed

playbooks/roles/devconfig/tasks/install-deps/debian/main.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,52 @@
11
---
2+
- name: Update package lists
3+
become: true
4+
become_method: sudo
5+
ansible.builtin.shell:
6+
cmd: >
7+
DEBIAN_FRONTEND=noninteractive apt
8+
-o Acquire::Check-Valid-Until=false update
9+
when:
10+
- ansible_os_family == "Debian"
11+
- ansible_distribution_release == "trixie"
12+
tags: vars_simple
13+
register: apt_update_result
14+
retries: 5
15+
delay: 10
16+
until: apt_update_result.rc == 0
17+
18+
- name: Install required packages
19+
become: true
20+
become_method: sudo
21+
ansible.builtin.shell:
22+
cmd: >
23+
DEBIAN_FRONTEND=noninteractive apt install -y
24+
python3-setuptools libapt-pkg-dev python3-pip git
25+
when:
26+
- ansible_os_family == "Debian"
27+
- ansible_distribution_release == "trixie"
28+
tags: vars_simple
29+
30+
- name: Install python-apt from Git with pip3
31+
become: true
32+
become_method: sudo
33+
ansible.builtin.shell:
34+
cmd: >
35+
pip3 install
36+
git+https://salsa.debian.org/apt-team/[email protected]
37+
--break-system-packages
38+
when:
39+
- ansible_os_family == "Debian"
40+
- ansible_distribution_release == "trixie"
41+
tags: vars_simple
42+
43+
- name: Hold python3-apt package version
44+
become: yes
45+
ansible.builtin.command: apt-mark hold python3-apt
46+
when:
47+
- ansible_os_family == "Debian"
48+
tags: vars_simple
49+
250
- name: Remove unattended-upgrades package
351
become: yes
452
become_flags: 'su - -c'

0 commit comments

Comments
 (0)