From f4a4d438a164ddf121867ea383997f87ce1ff778 Mon Sep 17 00:00:00 2001 From: Lazlo Westerhof Date: Thu, 21 Nov 2024 16:15:45 +0100 Subject: [PATCH] Fix several venvs --- roles/icat_database_checker/tasks/main.yml | 17 +------------- roles/irods_arb/tasks/main.yml | 4 ++-- roles/irods_consistency_check/tasks/main.yml | 17 +------------- roles/irods_icat/tasks/setup_pam.yml | 8 +++---- .../yoda_external_user_service/tasks/main.yml | 4 ++-- roles/yoda_moai/tasks/main.yml | 23 ++----------------- roles/yoda_web_mock/tasks/main.yml | 4 ++-- 7 files changed, 14 insertions(+), 63 deletions(-) diff --git a/roles/icat_database_checker/tasks/main.yml b/roles/icat_database_checker/tasks/main.yml index e8f24db73..311187052 100644 --- a/roles/icat_database_checker/tasks/main.yml +++ b/roles/icat_database_checker/tasks/main.yml @@ -5,25 +5,10 @@ ansible.builtin.include_vars: "{{ ansible_os_family }}.yml" -- name: Check if icat-database-checker virtual environment is running Python 3.6 - ansible.builtin.stat: - path: '/var/lib/irods/icat-database-checker/bin/pip3.6' - register: idbc_venv_python36 - - -# For upgrade to Yoda 1.9 -- name: Move old icat-database-checker virtual environment - become_user: '{{ irods_service_account }}' - become: true - ansible.builtin.command: # noqa no-changed-when - cmd: "mv /var/lib/irods/icat-database-checker /var/lib/irods/icat-database-checker.backup-py3.6" - when: idbc_venv_python36.stat.exists - - - name: Ensure iCAT database checker virtualenv exists become_user: '{{ irods_service_account }}' become: true - ansible.builtin.command: "{{ icat_database_checker_python3_path }} -m virtualenv /var/lib/irods/icat-database-checker" + ansible.builtin.command: "{{ icat_database_checker_python3_path }} -m venv /var/lib/irods/icat-database-checker" args: creates: /var/lib/irods/icat-database-checker diff --git a/roles/irods_arb/tasks/main.yml b/roles/irods_arb/tasks/main.yml index 15ac112be..a553c01a7 100644 --- a/roles/irods_arb/tasks/main.yml +++ b/roles/irods_arb/tasks/main.yml @@ -15,10 +15,10 @@ state: '{{ "present" if irods_arb_enabled else "absent" }}' -- name: Ensure psutil is installed (Python 3) +- name: Ensure psutil is installed become_user: '{{ irods_service_account }}' become: true ansible.builtin.pip: name: "psutil==5.9.5" executable: "{{ irods_arb_pip3_location }}" - extra_args: --user + extra_args: --user --break-system-packages diff --git a/roles/irods_consistency_check/tasks/main.yml b/roles/irods_consistency_check/tasks/main.yml index b44ce0075..b86d0c384 100644 --- a/roles/irods_consistency_check/tasks/main.yml +++ b/roles/irods_consistency_check/tasks/main.yml @@ -5,25 +5,10 @@ ansible.builtin.include_vars: "{{ ansible_os_family }}.yml" -- name: Check if ichk virtual environment is running Python 3.6 - ansible.builtin.stat: - path: '/var/lib/irods/irods-consistency-check/bin/pip3.6' - register: ichk_venv_python36 - - -# For upgrade to Yoda 1.9 -- name: Move old ichk virtual environment - become_user: '{{ irods_service_account }}' - become: true - ansible.builtin.command: # noqa no-changed-when - cmd: "mv /var/lib/irods/irods-consistency-check /var/lib/irods/irods-consistency-check.backup-py3.6" - when: ichk_venv_python36.stat.exists - - - name: Ensure iRODS consistency check virtualenv exists become_user: '{{ irods_service_account }}' become: true - ansible.builtin.command: "{{ irods_consistency_check_python3_path }} -m virtualenv /var/lib/irods/irods-consistency-check" + ansible.builtin.command: "{{ irods_consistency_check_python3_path }} -m venv /var/lib/irods/irods-consistency-check" args: creates: /var/lib/irods/irods-consistency-check diff --git a/roles/irods_icat/tasks/setup_pam.yml b/roles/irods_icat/tasks/setup_pam.yml index 65d65595f..8fb7c5fd6 100644 --- a/roles/irods_icat/tasks/setup_pam.yml +++ b/roles/irods_icat/tasks/setup_pam.yml @@ -65,10 +65,10 @@ when: enable_tokens and ansible_os_family == 'Debian' and '1.0.4' in pysqlcipher3_version.stdout -#- name: Ensure custom build of pysqlcipher3 is installed globally for token authentication script -# ansible.builtin.command: # noqa no-changed-when -# cmd: python3 -m easy_install https://github.com/UtrechtUniversity/pysqlcipher3/releases/download/v1.2.1/pysqlcipher3-1.2.1-py2.7-linux-x86_64.egg -# when: enable_tokens and ansible_os_family == 'Debian' and '1.2.1' not in pysqlcipher3_version.stdout +# - name: Ensure custom build of pysqlcipher3 is installed globally for token authentication script +# ansible.builtin.command: # noqa no-changed-when +# cmd: python3 -m easy_install https://github.com/UtrechtUniversity/pysqlcipher3/releases/download/v1.2.1/pysqlcipher3-1.2.1-py2.7-linux-x86_64.egg +# when: enable_tokens and ansible_os_family == 'Debian' and '1.2.1' not in pysqlcipher3_version.stdout - name: Ensure token authentication script is present diff --git a/roles/yoda_external_user_service/tasks/main.yml b/roles/yoda_external_user_service/tasks/main.yml index 3419a947d..bf6ac7572 100644 --- a/roles/yoda_external_user_service/tasks/main.yml +++ b/roles/yoda_external_user_service/tasks/main.yml @@ -200,7 +200,7 @@ - name: Ensure Yoda EUS virtualenv exists become_user: '{{ yoda_deployment_user }}' become: true - ansible.builtin.command: "virtualenv --python {{ yoda_external_user_service_python3_path }} /var/www/extuser/yoda-external-user-service/venv" + ansible.builtin.command: "{{ yoda_external_user_service_python3_path }} -m venv /var/www/extuser/yoda-external-user-service/venv" args: creates: "/var/www/extuser/yoda-external-user-service/venv" @@ -210,7 +210,7 @@ become: true ansible.builtin.pip: name: - - pip==23.0.1 + - pip==24.3.1 executable: /var/www/extuser/yoda-external-user-service/venv/bin/pip3 when: not ansible_check_mode diff --git a/roles/yoda_moai/tasks/main.yml b/roles/yoda_moai/tasks/main.yml index 85ae031f4..43b4fa211 100644 --- a/roles/yoda_moai/tasks/main.yml +++ b/roles/yoda_moai/tasks/main.yml @@ -47,29 +47,10 @@ register: repochanges -- name: Check if MOAI virtual environment is running Python 2.7 - ansible.builtin.stat: - path: '/var/www/moai/yoda-moai/venv/bin/pip2.7' - register: moai_venv_python27 - - -- name: Check if MOAI virtual environment is running Python 3.6 - ansible.builtin.stat: - path: '/var/www/moai/yoda-moai/venv/bin/pip3.6' - register: moai_venv_python36 - - -# For upgrade to Yoda 1.9 -- name: Move old MOAI virtual environment - ansible.builtin.command: # noqa no-changed-when - cmd: "mv /var/www/moai/yoda-moai/venv /var/www/moai/venv.backup-pre-1.9" - when: moai_venv_python27.stat.exists or moai_venv_python36.stat.exists - - - name: Ensure Yoda MOAI virtualenv exists become_user: '{{ yoda_moai_user }}' become: true - ansible.builtin.command: "virtualenv --python {{ yoda_moai_python3_path }} {{ yoda_moai_home }}/yoda-moai/venv" + ansible.builtin.command: "{{ yoda_moai_python3_path }} -m venv {{ yoda_moai_home }}/yoda-moai/venv" args: creates: "{{ yoda_moai_home }}/yoda-moai/venv" @@ -79,7 +60,7 @@ become: true ansible.builtin.pip: name: - - pip==23.0.1 + - pip==24.3.1 executable: /var/www/moai/yoda-moai/venv/bin/pip3 diff --git a/roles/yoda_web_mock/tasks/main.yml b/roles/yoda_web_mock/tasks/main.yml index 27c4a7988..9c55c9ac5 100644 --- a/roles/yoda_web_mock/tasks/main.yml +++ b/roles/yoda_web_mock/tasks/main.yml @@ -35,7 +35,7 @@ - name: Ensure Yoda web mock virtualenv exists become_user: '{{ yoda_deployment_user }}' become: true - ansible.builtin.command: "virtualenv --python {{ yoda_web_mock_python3_path }} /var/www/webmock/venv" + ansible.builtin.command: "{{ yoda_web_mock_python3_path }} -m venv /var/www/webmock/venv" args: creates: "/var/www/webmock/venv" @@ -45,7 +45,7 @@ become: true ansible.builtin.pip: name: - - pip==23.0.1 + - pip==24.3.1 executable: /var/www/webmock/venv/bin/pip3 when: not ansible_check_mode