mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	Merge pull request #2885 from holta/virtualenv-for-kalite
Move packages 'python3-*' & 'virtualenv' (for Python 2) from scripts/ansible to roles that need them, e.g. {mysql, postgresql, munin, kalite}
			
			
This commit is contained in:
		
						commit
						702cfa3fcd
					
				
					 9 changed files with 36 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -30,6 +30,8 @@
 | 
			
		|||
      #- openssh-server    # ssh (Raspbian) or openssh-server (other OS's) already installed by 1-prep's roles/sshd/tasks/main.yml
 | 
			
		||||
      - pandoc             # For /usr/bin/iiab-refresh-wiki-docs
 | 
			
		||||
      - pastebinit         # For /usr/bin/iiab-diagnostics
 | 
			
		||||
      #- python3-pip       # 2021-07-29: Already installed by /opt/iiab/iiab/scripts/ansible -- this auto-installs 'python3-setuptools' and 'python3' etc
 | 
			
		||||
      #- python3-venv      # 2021-07-30: For Ansible module 'pip' used in roles like {calibre-web, jupyterhub, lokole} -- whereas roles/kalite uses (virtual) package 'virtualenv' for Python 2 -- all these 3+1 IIAB roles install 'python3-venv' for themselves.  FYI: Debian 11 auto-installs 'python3-venv' when you install 'python3' -- whereas Ubuntu (e.g. 20.04 & 21.10) and RaspiOS 10 do not.
 | 
			
		||||
      - rsync
 | 
			
		||||
      #- screen            # Installed by 1-prep's roles/iiab-admin/tasks/access.yml
 | 
			
		||||
      - sqlite3
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
- name: "Install ImageMagick package: imagemagick"
 | 
			
		||||
- name: "Install packages: imagemagick, python3-venv"
 | 
			
		||||
  package:
 | 
			
		||||
    name:
 | 
			
		||||
      - imagemagick
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,6 +13,11 @@
 | 
			
		|||
  when: nodejs_installed is undefined
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
- name: "Install package: python3-venv"
 | 
			
		||||
  package:
 | 
			
		||||
    name: python3-venv
 | 
			
		||||
    state: present
 | 
			
		||||
 | 
			
		||||
- name: Make 3 directories to hold JupyterHub config
 | 
			
		||||
  file:
 | 
			
		||||
    state: directory
 | 
			
		||||
| 
						 | 
				
			
			@ -40,8 +45,8 @@
 | 
			
		|||
      - jupyterhub-systemdspawner
 | 
			
		||||
    virtualenv: "{{ jupyterhub_venv }}"    # /opt/iiab/jupyterhub
 | 
			
		||||
    virtualenv_site_packages: no
 | 
			
		||||
    virtualenv_command: /usr/bin/virtualenv
 | 
			
		||||
    virtualenv_python: python3
 | 
			
		||||
    virtualenv_command: python3 -m venv "{{ jupyterhub_venv }}"    # 2021-07-29: This works on RaspiOS 10, Debian 11, Ubuntu 20.04 and Mint 20 -- however if you absolutely must use the older Debian 10 -- you can work around errors "can't find Rust compiler" and "This package requires Rust >=1.41.0" if you (1) revert this line to 'virtualenv_command: virtualenv' AND (2) uncomment the line just below
 | 
			
		||||
    #virtualenv_python: python3    # 2021-07-29: Was needed when above line was 'virtualenv_command: virtualenv' (generally for Python 2)
 | 
			
		||||
    extra_args: "--no-cache-dir"
 | 
			
		||||
  when: internet_available
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,13 +11,14 @@
 | 
			
		|||
#  ignore_errors: yes
 | 
			
		||||
#  when: is_raspbian
 | 
			
		||||
 | 
			
		||||
- name: Install python2, if Raspbian/Debian > 10 or Ubuntu > 19
 | 
			
		||||
- name: 'Install packages: python2, python-setuptools, virtualenv (for Python 2)'
 | 
			
		||||
  package:
 | 
			
		||||
    name:
 | 
			
		||||
      - python2
 | 
			
		||||
      - python-setuptools # provides setuptools-44 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}
 | 
			
		||||
    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.
 | 
			
		||||
 | 
			
		||||
- name: Use pip to pin setuptools to 44 in {{ kalite_venv }} if Raspbian/Debian > 10 or Ubuntu > 19
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,11 +1,12 @@
 | 
			
		|||
- name: "Install 4 packages: munin, munin-node, munin-plugins-extra, libcgi-fast-perl"
 | 
			
		||||
- name: "Install 5 packages: libcgi-fast-perl, munin, munin-node, munin-plugins-extra, python3-passlib"
 | 
			
		||||
  package:
 | 
			
		||||
    name:
 | 
			
		||||
      #- libapache2-mod-fcgid
 | 
			
		||||
      - libcgi-fast-perl
 | 
			
		||||
      - munin
 | 
			
		||||
      - munin-node
 | 
			
		||||
      - munin-plugins-extra
 | 
			
		||||
      - libcgi-fast-perl
 | 
			
		||||
      #- libapache2-mod-fcgid
 | 
			
		||||
      - python3-passlib    # For Ansible module 'htpasswd' in Ansible collection community.general -- used just below
 | 
			
		||||
    state: present
 | 
			
		||||
 | 
			
		||||
- name: Establish username/password Admin/changeme in /etc/munin/munin-htpasswd
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,6 +12,7 @@
 | 
			
		|||
      - mariadb-client
 | 
			
		||||
      #- php{{ php_version }}-common    # Auto-installed as an apt dependency.  REGARDLESS: php{{ php_version }}-common superset php{{ php_version }}-cli is auto-installed by php{{ php_version }}-fpm in nginx/tasks/install.yml
 | 
			
		||||
      - php{{ php_version }}-mysql      # Likewise installed in nextcloud/tasks/install.yml, pbx/tasks/freepbx_dependencies.yml, wordpress/tasks/install.yml
 | 
			
		||||
      - python3-pymysql                 # For Ansible modules {mysql_db, mysql_user} in Ansible collection community.mysql -- used in MySQL roles {mediawiki, nextcloud, wordpress} and possibly {elgg, pbx}
 | 
			
		||||
    state: present
 | 
			
		||||
 | 
			
		||||
# 2020-07-11:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,7 @@
 | 
			
		|||
    name:
 | 
			
		||||
      - postgresql
 | 
			
		||||
      - postgresql-client
 | 
			
		||||
      - python3-psycopg2    # For Ansible modules {postgresql_db, postgresql_user} in Ansible collection community.postgresql -- used in moodle/tasks/install.yml
 | 
			
		||||
    state: present
 | 
			
		||||
 | 
			
		||||
- name: Install /etc/systemd/system/postgresql-iiab.service from template (0644 by default)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,6 @@
 | 
			
		|||
# https://stackoverflow.com/questions/9952177/whats-the-meaning-of-the-parameter-e-for-bash-shell-command-line/9952249
 | 
			
		||||
 | 
			
		||||
# PLZ SEE http://FAQ.IIAB.IO > "What is Ansible and what version should I use?"
 | 
			
		||||
#         https://github.com/iiab/iiab/tree/master/scripts/ansible.md
 | 
			
		||||
#         https://github.com/iiab/iiab/wiki/IIAB-Contributors-Guide#ansible
 | 
			
		||||
 | 
			
		||||
APT_PATH=/usr/bin     # Avoids problematic /usr/local/bin/apt on Linux Mint
 | 
			
		||||
| 
						 | 
				
			
			@ -149,13 +148,24 @@ fi
 | 
			
		|||
###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)
 | 
			
		||||
 | 
			
		||||
echo -e "\napt update; apt install of python3-* / virtualenv packages explained at:"
 | 
			
		||||
echo -e "https://github.com/iiab/iiab/blob/master/scripts/ansible.md\n"
 | 
			
		||||
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"
 | 
			
		||||
$APT_PATH/apt update
 | 
			
		||||
$APT_PATH/apt -y install python3-pip
 | 
			
		||||
 | 
			
		||||
# 2021-07-29:
 | 
			
		||||
# 'python3-packaging' dropped for now
 | 
			
		||||
# 'python3-pymysql' (drags in 'python3' which drags in 'python3-venv' on Debian 11 but not on Ubuntu 20.04) -- moved to roles/mysql/tasks/install.yml
 | 
			
		||||
# 'python3-psycopg2' moved to roles/postgresql/tasks/install.yml
 | 
			
		||||
# 'python3-passlib' moved to roles/munin/tasks/install.yml
 | 
			
		||||
# 'python3-venv' moved to roles/2-common/tasks/packages.yml
 | 
			
		||||
# 'virtualenv' for Python 2 moved to roles/kalite/tasks/install.yml
 | 
			
		||||
#
 | 
			
		||||
#$APT_PATH/apt -y install \
 | 
			
		||||
#              python3-pymysql python3-psycopg2 python3-passlib python3-pip \
 | 
			
		||||
#              python3-setuptools python3-packaging python3-venv virtualenv
 | 
			
		||||
 | 
			
		||||
#$APT_PATH/apt -y --allow-downgrades install ansible-core \
 | 
			
		||||
$APT_PATH/apt -y install \
 | 
			
		||||
              python3-pymysql python3-psycopg2 python3-passlib python3-pip \
 | 
			
		||||
              python3-setuptools python3-packaging python3-venv virtualenv
 | 
			
		||||
 | 
			
		||||
echo -e "\n\n'pip3 install --upgrade ansible-core' will now run:\n"
 | 
			
		||||
pip3 install --upgrade ansible-core
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue