diff --git a/tasks/plus/install-pip2.yml b/tasks/plus/install-pip2.yml new file mode 100644 index 000000000..3a67bd372 --- /dev/null +++ b/tasks/plus/install-pip2.yml @@ -0,0 +1,19 @@ +- name: (Python 2) Get version 2.7 'pip' script + ansible.builtin.get_url: + url: "https://bootstrap.pypa.io/pip/2.7/get-pip.py" + dest: "/tmp/get-pip.py" + mode: "0755" + +- name: (Python 2) Check if 'pip' binary exists + ansible.builtin.stat: + path: /usr/bin/pip + ignore_errors: true + register: pip + +- name: (Python 2) Install 'pip' version 2.7 + ansible.builtin.command: "python get-pip.py" + args: + chdir: /tmp/ + when: not pip.stat.exists + register: pip_install + changed_when: pip_install.changed diff --git a/tasks/plus/install-pip3.yml b/tasks/plus/install-pip3.yml new file mode 100644 index 000000000..dc325aeca --- /dev/null +++ b/tasks/plus/install-pip3.yml @@ -0,0 +1,7 @@ +- name: (Python 3) Install 'pip' package + ansible.builtin.package: + name: python3-pip + +- name: (Python 3) Ensure 'pip' is updated + ansible.builtin.pip: + name: pip>=21.2.4 diff --git a/tasks/plus/setup-license.yml b/tasks/plus/setup-license.yml index 4f6b188cb..1689e9b58 100644 --- a/tasks/plus/setup-license.yml +++ b/tasks/plus/setup-license.yml @@ -47,6 +47,9 @@ - name: (Debian/Red Hat/SLES OSs) Set up NGINX Plus license when: ansible_facts['os_family'] != 'Alpine' block: + - name: (RedHat) Install pip + ansible.builtin.include_tasks: "{{ role_path }}/tasks/plus/install-pip{{ ansible_python['version']['major'] }}.yml" + - name: (Debian/Red Hat/SLES OSs) Create SSL directory ansible.builtin.file: path: /etc/ssl/nginx @@ -64,8 +67,8 @@ - "{{ nginx_license['key'] }}" - name: (Debian/Red Hat/SLES OSs) Install cryptography package - ansible.builtin.package: - name: "{{ (ansible_python['version']['major'] == 3) | ternary('python3-cryptography', 'python2-cryptography') }}" + ansible.builtin.pip: + name: cryptography when: not (ansible_facts['distribution'] == "OracleLinux" and ansible_facts['distribution_major_version'] == "8") - name: (OracleLinux 8) Install cryptography package