]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ansible: Install python3 deps on Bionic and up 1516/head
authorDavid Galloway <dgallowa@redhat.com>
Thu, 5 Mar 2020 16:31:56 +0000 (11:31 -0500)
committerDavid Galloway <dgallowa@redhat.com>
Fri, 6 Mar 2020 19:08:23 +0000 (14:08 -0500)
Again, I don't know how this was working before but I also had to set `executable:` under the pip tasks in order for them to work on all distros.

Signed-off-by: David Galloway <dgallowa@redhat.com>
ansible/examples/slave.yml
ansible/examples/slave_static.yml

index 062a6ac9bf16bdb4d3a20fac7cf33f5e834dfc1c..64a4fbc1baea6067ed7ab8237abb6b19d72a60c3 100644 (file)
         - ant
       when: ansible_pkg_mgr  == "apt"
 
-    # For now schroot/dchroot are the only package differences.  This may change.
-    # Just change this to be a list if that happens.
     - name: Install DEB requirements (>=18.04)
       apt:
-        name: schroot
+        name: "{{ item }}"
         state: present
+      with_items:
+        - schroot
+        - python3-dev
+        - python3-pip
+        - python3-virtualenv
       when:
         - ansible_pkg_mgr  == "apt"
         - ansible_distribution_major_version|int >= 18
       failed_when: false
       when: ansible_os_family == "Suse"
 
+    - set_fact:
+        pip_version: pip
+      when: (ansible_os_family == "RedHat" and ansible_distribution_major_version|int <= 7) or
+            ansible_os_family == "Debian" or
+            ansible_os_family == "Suse"
+
+    - set_fact:
+        pip_version: pip3
+      when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 8
 
     - name: install six, latest one
       pip:
         name: six
         state: latest
+        executable: "{{ pip_version }}"
       when: ansible_os_family != "Suse"
 
     - name: install python-jenkins
       pip:
         name: python-jenkins
         version: 0.4.15
+        executable: "{{ pip_version }}"
 
     - name: add github.com host key
       known_hosts:
         key: "{{ lookup('file', 'playbook/files/ssh/hostkeys/github.com.pub') }}"
       tags: github
 
+    # The jenkins_node library tries to use pip3 with python-jenkins but it's not compatible.
+    - set_fact:
+        ansible_python_interpreter: /usr/bin/python
+      when:
+        - ansible_os_family == "Debian"
+
     - name: register the new slave to jenkins master with ssh
       jenkins_node:
         username: "{{ api_user }}"
index 36d286a9bc4612ecdd97aa0e0780f3987884e342..dec9404e4acda1504fade1e3d9a4384f79bc2a1a 100644 (file)
         - curl
       when: ansible_pkg_mgr  == "apt"
 
-    # For now schroot/dchroot are the only package differences.  This may change.
-    # Just change this to be a list if that happens.
     - name: Install DEB requirements (>=18.04)
       apt:
-        name: schroot
+        name: "{{ item }}"
         state: present
+      with_items:
+        - schroot
+        - python3-dev
+        - python3-pip
+        - python3-virtualenv
       when:
         - ansible_pkg_mgr  == "apt"
         - ansible_distribution_major_version|int >= 18
         regexp: '^(127\.0\.1\.1(?!.*\b{{ ansible_hostname }}\b).*)$'
         line: '127.0.1.1 {{ ansible_hostname }}'
 
+    - set_fact:
+        pip_version: pip
+      when: (ansible_os_family == "RedHat" and ansible_distribution_major_version|int <= 7) or
+            ansible_os_family == "Debian" or
+            ansible_os_family == "Suse"
+
+    - set_fact:
+        pip_version: pip3
+      when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 8
+
     - name: install six, latest one
       become: true
-      pip: name=six state=latest
+      pip:
+        name: six
+        state: latest
+        executable: "{{ pip_version }}"
 
     - name: install python-jenkins
       become: true
       # https://review.openstack.org/460363
-      pip: name=python-jenkins version=0.4.15
+      pip:
+        name: python-jenkins
+        version: 0.4.15
+        executable: "{{ pip_version }}"
 
     - name: add github.com host key
       become: true
         # github.com.pub is the output of `ssh-keyscan github.com`
         key: "{{ lookup('file', 'files/ssh/hostkeys/github.com.pub') }}"
 
+    # The jenkins_node library tries to use pip3 with python-jenkins but it's not compatible.
+    - set_fact:
+        ansible_python_interpreter: /usr/bin/python
+      when:
+        - ansible_os_family == "Debian"
+
     - name: register the new slave to jenkins master with ssh
       jenkins_node:
         username: "{{ api_user }}"