From 504dd16bfc604ff269cdbd93ffd65e34539ffac6 Mon Sep 17 00:00:00 2001 From: Thorsten Bruhns Date: Thu, 6 Jul 2023 20:30:39 +0000 Subject: [PATCH] cx_oracle: Added installation of cx_Oracle for Python3 Important: The Release 3.8.0 of ansible-oracle changes the module oracle_db. It requires an installation of Python3 and cx_Oracle for Python3. The role cx_oracle installs cx_Oracle for Python2 and Python3 when 'ansible_python_interpreter' points to Python2. Please execute the role cx_oracle for old systems to install cx_Oracle for Python3. --- changelogs/fragments/cx_oracle.yml | 3 +++ changelogs/fragments/python2_deprecated.yml | 3 +++ roles/cxoracle/tasks/main.yml | 26 +++++++++++++++++---- 3 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 changelogs/fragments/cx_oracle.yml create mode 100644 changelogs/fragments/python2_deprecated.yml diff --git a/changelogs/fragments/cx_oracle.yml b/changelogs/fragments/cx_oracle.yml new file mode 100644 index 000000000..cfd51b7d9 --- /dev/null +++ b/changelogs/fragments/cx_oracle.yml @@ -0,0 +1,3 @@ +--- +breaking_changes: + - "cx_oracle: Added installation of cx_Oracle for Python3 (oravirt#346)" diff --git a/changelogs/fragments/python2_deprecated.yml b/changelogs/fragments/python2_deprecated.yml new file mode 100644 index 000000000..e112fa6ef --- /dev/null +++ b/changelogs/fragments/python2_deprecated.yml @@ -0,0 +1,3 @@ +--- +deprecated_features: + - "modules: all modules will loose support for Python2 in ansible-oracle 4.0.0 (oravirt#346)" diff --git a/roles/cxoracle/tasks/main.yml b/roles/cxoracle/tasks/main.yml index 67d7f2bf0..cdfba3066 100644 --- a/roles/cxoracle/tasks/main.yml +++ b/roles/cxoracle/tasks/main.yml @@ -1,10 +1,26 @@ # cxoracle-install playbook --- -- name: Install cx_oracle +# The cx_Oracle is installed for Python2 only, when Python2 is +# used as an interpreter in Ansible. +- name: Install cx_oracle for Python2 ansible.builtin.pip: - name: "{{ cx_oracle_source | default('cx_oracle<8.0') }}" - extra_args: "{{ extra_args }}" - umask: "{{ cx_oracle_umask | default(omit) }}" - state: present + name: "{{ cx_oracle_source | default('cx_oracle<8.0') }}" + extra_args: "{{ extra_args }}" + umask: "{{ cx_oracle_umask | default(omit) }}" + state: present + when: + - install_cx_oracle + - ansible_python.version.major == 2 + tags: cx_oracle + +# The future ansible-oracle modules are using Python3 only +# => Install cx_Oracle for Python3 as well +- name: Install cx_oracle for Python3 + ansible.builtin.pip: + name: "{{ cx_oracle3_source | default(cx_oracle_source) | default('cx_oracle') }}" + executable: pip3 + extra_args: "{{ extra_args }}" + umask: "{{ cx_oracle_umask | default(omit) }}" + state: present when: install_cx_oracle tags: cx_oracle