mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Merge pull request #3496 from holta/ansible_venv
venv refinements for consideration, to tighten up scripts/ansible, deferring install of pip unless truly nec
This commit is contained in:
commit
e832ec6635
6 changed files with 40 additions and 16 deletions
|
@ -29,7 +29,7 @@
|
||||||
- name: JUPYTERHUB
|
- name: JUPYTERHUB
|
||||||
include_role:
|
include_role:
|
||||||
name: jupyterhub
|
name: jupyterhub
|
||||||
when: jupyterhub_install and ansible_machine is search("64") # 2022-11-10: Avoid installing on 32-bit, until RasPiOS fixes Rust (PR #3421)
|
when: jupyterhub_install
|
||||||
|
|
||||||
# UNMAINTAINED
|
# UNMAINTAINED
|
||||||
- name: LOKOLE
|
- name: LOKOLE
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
- name: CALIBRE-WEB
|
- name: CALIBRE-WEB
|
||||||
include_role:
|
include_role:
|
||||||
name: calibre-web
|
name: calibre-web
|
||||||
when: calibreweb_install and ansible_machine is search("64") # 2022-11-10: Avoid installing on 32-bit, until RasPiOS fixes Rust (PR #3421)
|
when: calibreweb_install
|
||||||
|
|
||||||
# KEEP NEAR THE VERY END as this installs dependencies from Debian's 'testing' branch!
|
# KEEP NEAR THE VERY END as this installs dependencies from Debian's 'testing' branch!
|
||||||
- name: CALIBRE
|
- name: CALIBRE
|
||||||
|
@ -42,6 +42,14 @@
|
||||||
name: pbx
|
name: pbx
|
||||||
when: pbx_install
|
when: pbx_install
|
||||||
|
|
||||||
|
- name: "INSTALL python3-pip FOR ADMIN CONSOLE 'cmdsrv : Download speedtest-cli' SEE PR #3494 -- INSTALL python3-jinja2 FOR ADMIN CONSOLE 'js-menu : Post process the downloaded menu defs' SEE PR #3496 -- REMOVE THIS CODE LATER"
|
||||||
|
package:
|
||||||
|
name:
|
||||||
|
- python3-pip
|
||||||
|
- python3-jinja2
|
||||||
|
state: present
|
||||||
|
when: admin_console_install
|
||||||
|
|
||||||
- name: Recording STAGE 9 HAS COMPLETED ====================
|
- name: Recording STAGE 9 HAS COMPLETED ====================
|
||||||
lineinfile:
|
lineinfile:
|
||||||
path: "{{ iiab_env_file }}"
|
path: "{{ iiab_env_file }}"
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
- name: "Install packages: imagemagick, python3-venv"
|
- name: "Install packages: imagemagick, python3-venv, build-essential"
|
||||||
package:
|
package:
|
||||||
name:
|
name:
|
||||||
- imagemagick
|
- imagemagick
|
||||||
- python3-venv
|
- python3-venv
|
||||||
|
#- python3-dev
|
||||||
|
- build-essential
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Allow ImageMagick to read PDFs, per /etc/ImageMagick-6/policy.xml, to create book cover thumbnails
|
- name: Allow ImageMagick to read PDFs, per /etc/ImageMagick-6/policy.xml, to create book cover thumbnails
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
name:
|
name:
|
||||||
- python2
|
- python2
|
||||||
- python-setuptools # Provides setuptools-44 on recent OS's (last version compatible with python2)
|
- python-setuptools # Provides setuptools-44 on recent OS's (last version compatible with python2)
|
||||||
- virtualenv # For Ansible module 'pip' when used with 'virtualenv_command: /usr/bin/virtualenv' and 'virtualenv_python: python2.7' -- compare package 'python3-venv' used by roles {calibre-web, jupyterhub, lokole}
|
- virtualenv # Drags in 'python3-virtualenv' which in turn drags in 'python3-pip' -- for Ansible module 'pip' when used with 'virtualenv_command: /usr/bin/virtualenv' and 'virtualenv_python: python2.7' -- compare package 'python3-venv' used by roles {calibre-web, jupyterhub, lokole}
|
||||||
state: present
|
state: present
|
||||||
#when: not (is_debian_9 or is_debian_10 or is_ubuntu_16 or is_ubuntu_17 or is_ubuntu_18 or is_ubuntu_19)
|
#when: not (is_debian_9 or is_debian_10 or is_ubuntu_16 or is_ubuntu_17 or is_ubuntu_18 or is_ubuntu_19)
|
||||||
# 2020-03-31: Testing for {is_raspbian_9, is_raspbian_10} is not currently nec, as testing for {is_debian_9, is_debian_10} covers that already.
|
# 2020-03-31: Testing for {is_raspbian_9, is_raspbian_10} is not currently nec, as testing for {is_debian_9, is_debian_10} covers that already.
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
# https://github.com/iiab/iiab/blob/master/roles/www_base/templates/iiab-refresh-wiki-docs.sh#L51-L52
|
# https://github.com/iiab/iiab/blob/master/roles/www_base/templates/iiab-refresh-wiki-docs.sh#L51-L52
|
||||||
|
|
||||||
|
|
||||||
- name: Install 14 packages for Lokole
|
- name: Install 13 packages for Lokole
|
||||||
apt:
|
apt:
|
||||||
name:
|
name:
|
||||||
#- python3 # 2022-12-21: IIAB pre-req, see scripts/local_facts.fact
|
#- python3 # 2022-12-21: IIAB pre-req, see scripts/local_facts.fact
|
||||||
- python3-pip
|
#- python3-pip
|
||||||
- python3-venv
|
- python3-venv
|
||||||
- python3-dev
|
- python3-dev
|
||||||
- python3-bcrypt # 2019-10-14: Should work across modern Linux OS's
|
- python3-bcrypt # 2019-10-14: Should work across modern Linux OS's
|
||||||
|
|
|
@ -160,10 +160,10 @@ fi
|
||||||
###echo -e 'ENSURE ANSIBLE UPDATES CLEANLY: (then re-run this script to be sure!)\n'
|
###echo -e 'ENSURE ANSIBLE UPDATES CLEANLY: (then re-run this script to be sure!)\n'
|
||||||
###grep '^deb .*ansible' /etc/apt/sources.list /etc/apt/sources.list.d/*.list | grep -v '^/etc/apt/sources.list.d/iiab-ansible.list:' || true # Override bash -e (instead of aborting at 1st error)
|
###grep '^deb .*ansible' /etc/apt/sources.list /etc/apt/sources.list.d/*.list | grep -v '^/etc/apt/sources.list.d/iiab-ansible.list:' || true # Override bash -e (instead of aborting at 1st error)
|
||||||
|
|
||||||
echo -e "\napt update; apt install python3-pip # Also installs 'python3-setuptools' and 'python3' etc"
|
#echo -e "\napt update; apt install python3-pip # Also installs 'python3-setuptools' and 'python3' etc"
|
||||||
#echo -e "https://github.com/iiab/iiab/blob/master/scripts/ansible.md\n"
|
#echo -e "https://github.com/iiab/iiab/blob/master/scripts/ansible.md\n"
|
||||||
$APT_PATH/apt update
|
#$APT_PATH/apt update
|
||||||
$APT_PATH/apt -y install python3-pip
|
#$APT_PATH/apt -y install python3-pip
|
||||||
|
|
||||||
# 2021-07-29:
|
# 2021-07-29:
|
||||||
# 'python3-packaging' dropped for now
|
# 'python3-packaging' dropped for now
|
||||||
|
@ -183,17 +183,30 @@ $APT_PATH/apt -y install python3-pip
|
||||||
# cache system-wide before installing:
|
# cache system-wide before installing:
|
||||||
# https://stackoverflow.com/questions/9510474/removing-pips-cache/61762308#61762308
|
# https://stackoverflow.com/questions/9510474/removing-pips-cache/61762308#61762308
|
||||||
# https://github.com/iiab/iiab/pull/3022
|
# https://github.com/iiab/iiab/pull/3022
|
||||||
pip3 config --global set global.no-cache-dir false
|
#pip3 config --global set global.no-cache-dir false
|
||||||
|
|
||||||
if ! uname -m | grep -q 64; then
|
#if ! uname -m | grep -q 64; then
|
||||||
# echo "2022-11-09: ansible-core 2.12.10+ PPA works on 32-bit RasPiOS, using /etc/apt/sources.list.d/iiab-ansible.list, until upstream wheels -> cryptography is fixed (PR #3421)"
|
# echo "2022-11-09: ansible-core 2.12.10+ PPA works on 32-bit RasPiOS, using /etc/apt/sources.list.d/iiab-ansible.list, until upstream wheels -> cryptography is fixed (PR #3421)"
|
||||||
# $APT_PATH/apt -y --allow-downgrades install ansible-core
|
# $APT_PATH/apt -y --allow-downgrades install ansible-core
|
||||||
echo -e "\n\n'pip3 install cryptography==39.0.2' will now run:\n"
|
# echo -e "\n\n'pip3 install cryptography==39.0.2' will now run:\n"
|
||||||
pip3 install --break-system-packages cryptography==39.0.2 || pip3 install cryptography==39.0.2 # PR #3459 https://www.piwheels.org/project/cryptography/ -- WAS 37.0.4 which as of 2023-01-06 was the "latest compatible with ansible-core available via piwheels.org"
|
# pip3 install --break-system-packages cryptography==39.0.2 || pip3 install cryptography==39.0.2 # PR #3459 https://www.piwheels.org/project/cryptography/ -- WAS 37.0.4 which as of 2023-01-06 was the "latest compatible with ansible-core available via piwheels.org"
|
||||||
fi
|
#fi
|
||||||
|
|
||||||
echo -e "\n\n'pip3 install --upgrade ansible-core' will now run:\n" # REMINDER: ansible-core 2.12 (released 2021-11-08) requires Python >= 3.8
|
#echo -e "\n\n'pip3 install --upgrade ansible-core' will now run:\n" # REMINDER: ansible-core 2.12 (released 2021-11-08) requires Python >= 3.8
|
||||||
pip3 install --break-system-packages --upgrade ansible-core || pip3 install --upgrade ansible-core # PR #3493: Revert to old syntax if pip < 23.0.1, as flag --break-system-packages (for Python 3.11+ / PEP 668) is brand new in Feb 2023: https://github.com/pypa/pip/pull/11780
|
#pip3 install --break-system-packages --upgrade ansible-core || pip3 install --upgrade ansible-core # PR #3493: Revert to old syntax if pip < 23.0.1, as flag --break-system-packages (for Python 3.11+ / PEP 668) is brand new in Feb 2023: https://github.com/pypa/pip/pull/11780
|
||||||
|
|
||||||
|
echo -e "\napt update; apt install python3-venv"
|
||||||
|
$APT_PATH/apt update
|
||||||
|
$APT_PATH/apt -y install python3-venv
|
||||||
|
|
||||||
|
echo -e "\nCreate virtual environment for Ansible"
|
||||||
|
python3 -m venv /usr/local/ansible
|
||||||
|
/usr/local/ansible/bin/python3 -m pip install --upgrade ansible-core
|
||||||
|
echo -e "\nCreate symlinks /usr/local/bin/ansible* -> /usr/local/ansible/bin/ansible*"
|
||||||
|
cd /usr/local/ansible/bin
|
||||||
|
for bin in $(ls ansible*); do
|
||||||
|
ln -sf /usr/local/ansible/bin/$bin /usr/local/bin/$bin
|
||||||
|
done
|
||||||
|
|
||||||
# (Re)running collection installs appears safe, with --force-with-deps to force
|
# (Re)running collection installs appears safe, with --force-with-deps to force
|
||||||
# upgrade of collection and dependencies it pulls in. Note Ansible may support
|
# upgrade of collection and dependencies it pulls in. Note Ansible may support
|
||||||
|
@ -216,6 +229,7 @@ ansible-galaxy collection install --force-with-deps \
|
||||||
|
|
||||||
echo -e "\n\nSUCCESS! PLEASE VERIFY ANSIBLE WITH COMMANDS LIKE:\n"
|
echo -e "\n\nSUCCESS! PLEASE VERIFY ANSIBLE WITH COMMANDS LIKE:\n"
|
||||||
echo -e " ansible --version"
|
echo -e " ansible --version"
|
||||||
|
echo -e " /usr/local/ansible/bin/pip3 show ansible-core"
|
||||||
echo -e " pip3 show ansible-core"
|
echo -e " pip3 show ansible-core"
|
||||||
echo -e ' apt -a list "ansible*"'
|
echo -e ' apt -a list "ansible*"'
|
||||||
echo -e " ansible-galaxy collection list\n"
|
echo -e " ansible-galaxy collection list\n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue