Skip to content

Commit

Permalink
Ubuntu 24.04 updates. Move to poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
never147 committed May 17, 2024
1 parent c1c2579 commit d6b8e63
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 33 deletions.
15 changes: 8 additions & 7 deletions bin/apply.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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[@]}" \
Expand Down
17 changes: 6 additions & 11 deletions bin/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -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
12 changes: 0 additions & 12 deletions requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion roles/backup/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion roles/dev-toolchain/tasks/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
apt:
name:
- build-essential
- python3-distutils
- python3-jsonschema
- python3-pip
- python3-setuptools
Expand All @@ -50,6 +49,7 @@
- retry
- clang-format
- pipx
- python3-argcomplete
state: latest

- name: Remove obsolete packages
Expand Down
3 changes: 2 additions & 1 deletion roles/yubikey/tasks/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
follow: yes
state: hard
force: yes
failed_when: false

- name: OpenSC lib link
file:
path: /usr/local/lib/opensc-pkcs11.so
src: /usr/lib/x86_64-linux-gnu/opensc-pkcs11.so
state: hard
force: yes

failed_when: false

0 comments on commit d6b8e63

Please sign in to comment.