File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,21 +4,19 @@ set -euo pipefail
44SCRIPT_DIR=" $( cd " $( dirname " $0 " ) " && pwd) "
55
66USER_BIN=" $( python3 -m site --user-base) /bin"
7- export PATH=" ${PATH } :${USER_BIN } "
7+ export PATH=" ${USER_BIN } :${PATH } "
88
99# Persist to ~/.bashrc if not already present
1010if ! grep -qF " ${USER_BIN} " " ${HOME} /.bashrc" ; then
1111 printf ' \nexport PATH="${PATH}:%s"\n' " ${USER_BIN} " >> " ${HOME} /.bashrc"
1212 echo " Added ${USER_BIN} to ~/.bashrc"
1313fi
1414
15- PIPX_PACKAGES=(
16- ansible-core
17- ansible-lint
18- yamllint
19- )
15+ # Install ansible-core as the primary package, then inject ansible-lint into
16+ # the same venv so both share the same ansible binary and collections path.
17+ pipx upgrade ansible-core 2> /dev/null || pipx install ansible-core
18+ pipx inject --include-apps --force ansible-core ansible-lint
2019
21- for package in " ${PIPX_PACKAGES[@]} " ; do
22- pipx upgrade " ${package} " 2> /dev/null || pipx install " ${package} "
23- done
24- ansible-galaxy collection install -r " ${SCRIPT_DIR} /requirements.yml" --upgrade
20+ pipx upgrade yamllint 2> /dev/null || pipx install yamllint
21+
22+ ansible-galaxy collection install -r " ${SCRIPT_DIR} /requirements.yml" --upgrade
Original file line number Diff line number Diff line change 22set -euo pipefail
33
44SCRIPT_DIR=" $( cd " $( dirname " $0 " ) " && pwd) "
5+ REQ_FILE=" ${SCRIPT_DIR} /requirements.txt"
56
67# Ensure python3, pip, and venv are installed
78PYTHON_PACKAGES=(
@@ -16,10 +17,10 @@ if ! dpkg -s "${PYTHON_PACKAGES[@]}" &>/dev/null; then
1617 sudo apt-get install -y " ${PYTHON_PACKAGES[@]} "
1718fi
1819
19- # Ensure user-local bin is on PATH for pip-installed CLIs
20- export PATH=" ${PATH } :$( python3 -m site --user-base ) /bin "
20+ USER_BIN= " $( python3 -m site --user-base ) /bin "
21+ export PATH=" ${USER_BIN } :${PATH} "
2122
22- # Install requirements
23- REQ_FILE=" ${SCRIPT_DIR} /requirements.txt"
23+ # Install pip if missing
2424python3 -m ensurepip --upgrade > /dev/null 2>&1 || true
2525python3 -m pip install --user --break-system-packages --upgrade -r " ${REQ_FILE} "
26+
You can’t perform that action at this time.
0 commit comments