From 903ab24b34796ebbb88f234b3e155b3b6e44a74c Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Sun, 13 May 2018 09:28:55 -0500 Subject: [PATCH] Gate: Dont deploy pip dist package if already installed This PS stops the gate playbook trying to deploy pip via dist packages if its already deployed. Change-Id: I8c4f41ad1253c03d523646a6df696e8b115cf528 --- roles/deploy-python-pip/tasks/main.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/roles/deploy-python-pip/tasks/main.yaml b/roles/deploy-python-pip/tasks/main.yaml index a48868a54..8a2b04ec6 100644 --- a/roles/deploy-python-pip/tasks/main.yaml +++ b/roles/deploy-python-pip/tasks/main.yaml @@ -12,14 +12,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +- name: check if pip installed + command: pip --version + register: pip_version_output + ignore_errors: yes + changed_when: false + - name: ensuring python pip package is present for ubuntu - when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' + when: ( pip_version_output is failed ) and ( ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' ) apt: name: python-pip state: present - name: ensuring python pip package is present for centos - when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' + when: ( pip_version_output is failed ) and ( ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' ) block: - name: ensuring epel-release package is present for centos as python-pip is in the epel repo yum: @@ -30,8 +36,8 @@ name: python-devel state: present -- name: ensuring python pip package is present for fedora via the python-devel rpm - when: ansible_distribution == 'Fedora' +- name: ensuring python pip package is present for fedora via the python2-pip rpm + when: ( pip_version_output is failed ) and ( ansible_distribution == 'Fedora' ) dnf: name: python2-pip state: present