From 8ec37bd1eb193de00724bfd6dda9518dc89596af Mon Sep 17 00:00:00 2001 From: gbloquel <1573530+gbloquel@users.noreply.github.com> Date: Thu, 11 Jan 2024 17:10:48 +0100 Subject: [PATCH] Allow install the packages on Debian12 (#138) * fix(role_pip): allow use in debian12 * fix(stage1/pip) allow install duplicity --- Makefile | 2 +- roles/stage1_pip/defaults/main.yml | 3 +++ .../tasks/{debian_11 => debian}/_install.yml | 5 +++++ roles/stage1_pip/tasks/debian/_prepare.yml | 17 +++++++++++++++++ .../tasks/{debian_11 => debian}/main.yml | 0 roles/stage1_pip/tasks/debian_11/_prepare.yml | 6 ------ 6 files changed, 26 insertions(+), 7 deletions(-) rename roles/stage1_pip/tasks/{debian_11 => debian}/_install.yml (60%) create mode 100644 roles/stage1_pip/tasks/debian/_prepare.yml rename roles/stage1_pip/tasks/{debian_11 => debian}/main.yml (100%) delete mode 100644 roles/stage1_pip/tasks/debian_11/_prepare.yml diff --git a/Makefile b/Makefile index ea236d4c..c215cb15 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ install-requirements: ## Install system dependencies @echo "—————————————————————————————— SYSTEM REQUIREMENTS ———————————————————————————" @sudo apt-get install -y \ python3 python3-dev python3-venv python3-pip direnv bash bash-completion \ - lsb-release unzip curl sshpass skopeo + lsb-release unzip curl sshpass skopeo librsync-dev @grep -q 'eval "$$(direnv hook bash)"' ~/.bashrc || \ echo 'eval "$$(direnv hook bash)"' >> ~/.bashrc diff --git a/roles/stage1_pip/defaults/main.yml b/roles/stage1_pip/defaults/main.yml index 5a1205d2..af1a62c7 100644 --- a/roles/stage1_pip/defaults/main.yml +++ b/roles/stage1_pip/defaults/main.yml @@ -12,3 +12,6 @@ packages_list: - cryptography - dnspython - passlib + - duplicity + +pip_root_folder_external: '/usr/lib/python3.11/EXTERNALLY-MANAGED' diff --git a/roles/stage1_pip/tasks/debian_11/_install.yml b/roles/stage1_pip/tasks/debian/_install.yml similarity index 60% rename from roles/stage1_pip/tasks/debian_11/_install.yml rename to roles/stage1_pip/tasks/debian/_install.yml index 9a366aa0..356906c0 100644 --- a/roles/stage1_pip/tasks/debian_11/_install.yml +++ b/roles/stage1_pip/tasks/debian/_install.yml @@ -1,4 +1,9 @@ --- +- name: 'Ensure not exists {{ pip_root_folder_external }}' + file: + path: '{{ pip_root_folder_external }}' + state: absent + - name: Install Python packages # noqa: command-instead-of-module command-instead-of-shell shell: > pip install --no-index --find-links=/var/cache/pip/ {{ packages_list | join(' ') }} diff --git a/roles/stage1_pip/tasks/debian/_prepare.yml b/roles/stage1_pip/tasks/debian/_prepare.yml new file mode 100644 index 00000000..3ba2c79a --- /dev/null +++ b/roles/stage1_pip/tasks/debian/_prepare.yml @@ -0,0 +1,17 @@ +--- +- name: Download dependencies for duplicity pip packages # noqa: command-instead-of-module + command: > + apt-get install -y --download-only librsync-dev + tags: + - online + +- name: Install dependencies for duplicity + ansible.builtin.apt: + name: librsync-dev + state: present + +- name: Download python packages # noqa: command-instead-of-module + shell: > + pip wheel --wheel-dir /var/cache/pip {{ packages_list | join(' ') }} + tags: + - online diff --git a/roles/stage1_pip/tasks/debian_11/main.yml b/roles/stage1_pip/tasks/debian/main.yml similarity index 100% rename from roles/stage1_pip/tasks/debian_11/main.yml rename to roles/stage1_pip/tasks/debian/main.yml diff --git a/roles/stage1_pip/tasks/debian_11/_prepare.yml b/roles/stage1_pip/tasks/debian_11/_prepare.yml deleted file mode 100644 index 4bdfc852..00000000 --- a/roles/stage1_pip/tasks/debian_11/_prepare.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- name: Download python packages # noqa: command-instead-of-module - shell: > - pip wheel --wheel-dir /var/cache/pip {{ packages_list | join(' ') }} - tags: - - online