From d6b8e633f475badee39ad03faba67cd79cef29c2 Mon Sep 17 00:00:00 2001 From: Matt Baker Date: Fri, 17 May 2024 22:55:09 +0100 Subject: [PATCH] Ubuntu 24.04 updates. Move to poetry --- bin/apply.sh | 15 ++++++++------- bin/bootstrap.sh | 17 ++++++----------- requirements.txt | 12 ------------ roles/backup/tasks/main.yml | 2 +- roles/dev-toolchain/tasks/ubuntu.yml | 2 +- roles/yubikey/tasks/ubuntu.yml | 3 ++- 6 files changed, 18 insertions(+), 33 deletions(-) delete mode 100644 requirements.txt diff --git a/bin/apply.sh b/bin/apply.sh index ed2b460..35f4631 100755 --- a/bin/apply.sh +++ b/bin/apply.sh @@ -2,17 +2,18 @@ base=$(dirname "$0")/.. cd "$base" || exit 1 -VENV_DIR=${VENV_DIR:="$HOME"/Apps/virtualenvs/home_dir} -if [ ! -f "$VENV_DIR"/bin/activate ] ;then +if [ ! -f ~/.local/bin/poetry ] ;then ./bin/bootstrap.sh fi -. "$VENV_DIR"/bin/activate - +poetry install +VENV_DIR=$(poetry env info -p) ( cd "$base"/collections \ - && ansible-galaxy collection install -p "${VENV_DIR}/collections" -r requirements.yml \ - && ansible-galaxy role install -p "${VENV_DIR}/roles" -r requirements.yml + && poetry run ansible-galaxy collection install \ + -p "${VENV_DIR}/collections" -r requirements.yml \ + && poetry run ansible-galaxy role install \ + -p "${VENV_DIR}/roles" -r requirements.yml ) [ -z "$CI" ] && ANSIBLE_EXTRA_ARGS=("--ask-become-pass") @@ -22,7 +23,7 @@ ANSIBLE_CALLBACK_WHITELIST=unixy \ ANSIBLE_STDOUT_CALLBACK=unixy \ ANSIBLE_COLLECTIONS_PATH="$VENV_DIR"/collections \ ANSIBLE_ROLES_PATH="$VENV_DIR"/roles:"$base"/roles \ -ansible-playbook \ +poetry run ansible-playbook \ -e @personal.yml \ -i inventories/local \ "${ANSIBLE_EXTRA_ARGS[@]}" \ diff --git a/bin/bootstrap.sh b/bin/bootstrap.sh index 453db03..a1779a9 100755 --- a/bin/bootstrap.sh +++ b/bin/bootstrap.sh @@ -1,19 +1,14 @@ #!/usr/bin/env bash set -x -#BASE=$(dirname "$0")/.. -#sudo apt-get install -y --install-recommends python3-dev +sudo apt-get install -y \ + --install-recommends \ + python3-full python3-dev \ + pipx libffi-dev mkdir -p ~/.local/bin export PATH=$PATH:~/.local/bin -if [ -f ~/.pip/pip.conf ] ;then - mv ~/.pip/pip.conf ~/.pip/pip.conv.orig -fi +pipx install poetry -export WORKON_HOME=$HOME/Apps/virtualenvs -mkdir -p "$WORKON_HOME" -python3 -m venv "$WORKON_HOME"/home_dir -. "$WORKON_HOME"/home_dir/bin/activate -pip install --upgrade pip -pip install -r requirements.txt +poetry install diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 6a45353..0000000 --- a/requirements.txt +++ /dev/null @@ -1,12 +0,0 @@ -ansible~=9.4.0 -ansible-core~=2.16.6 -beautifulsoup4==4.12.3 -cffi==1.16.0 -cryptography==42.0.5 -Jinja2==3.1.4 -MarkupSafe==2.1.5 -packaging==24.0 -pycparser==2.22 -PyYAML==6.0.1 -resolvelib==1.0.1 -soupsieve==2.5 diff --git a/roles/backup/tasks/main.yml b/roles/backup/tasks/main.yml index f749d0e..df5e2ad 100644 --- a/roles/backup/tasks/main.yml +++ b/roles/backup/tasks/main.yml @@ -12,7 +12,7 @@ set_fact: cache_directories: "{{ cache_directories|default([]) + [item.stat.path] }}" loop: "{{ cache_dirs_stat.results }}" - when: item.stat.exists + when: item.stat.exists and item.stat.isdir - name: Mark cache directories with a tag file copy: diff --git a/roles/dev-toolchain/tasks/ubuntu.yml b/roles/dev-toolchain/tasks/ubuntu.yml index 12dbf48..551c1fc 100644 --- a/roles/dev-toolchain/tasks/ubuntu.yml +++ b/roles/dev-toolchain/tasks/ubuntu.yml @@ -33,7 +33,6 @@ apt: name: - build-essential - - python3-distutils - python3-jsonschema - python3-pip - python3-setuptools @@ -50,6 +49,7 @@ - retry - clang-format - pipx + - python3-argcomplete state: latest - name: Remove obsolete packages diff --git a/roles/yubikey/tasks/ubuntu.yml b/roles/yubikey/tasks/ubuntu.yml index 0fbfd0a..2f18db3 100644 --- a/roles/yubikey/tasks/ubuntu.yml +++ b/roles/yubikey/tasks/ubuntu.yml @@ -20,6 +20,7 @@ follow: yes state: hard force: yes + failed_when: false - name: OpenSC lib link file: @@ -27,4 +28,4 @@ src: /usr/lib/x86_64-linux-gnu/opensc-pkcs11.so state: hard force: yes - + failed_when: false