Ansible job definitions for Zuul
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

47 lines
1.1 KiB

  1. - name: Install pip
  2. include_role:
  3. name: ensure-pip
  4. vars:
  5. ensure_pip_from_packages_with_python2: '{{ tox_prefer_python2 }}'
  6. - name: Check if tox is installed
  7. shell: |
  8. command -v {{ tox_executable }} || exit 1
  9. args:
  10. executable: /bin/bash
  11. register: tox_preinstalled
  12. failed_when: false
  13. - name: Export preinstalled tox_exectuable
  14. set_fact:
  15. tox_executable: '{{ tox_preinstalled.stdout }}'
  16. cacheable: true
  17. when: tox_preinstalled.rc == 0
  18. - name: Install tox to local env
  19. when: tox_preinstalled.rc != 0
  20. block:
  21. - name: Create local venv
  22. command: '{{ ensure_pip_virtualenv_command }} {{ tox_venv_path }}'
  23. - name: Install tox to local venv
  24. command: '{{ tox_venv_path }}/bin/pip install tox'
  25. - name: Export installed tox_executable path
  26. set_fact:
  27. tox_executable: '{{ tox_venv_path }}/bin/tox'
  28. cacheable: true
  29. - name: Output tox version
  30. command: "{{ tox_executable }} --version"
  31. - name: Make global symlink
  32. when:
  33. - ensure_global_symlinks
  34. - tox_executable != '/usr/local/bin/tox'
  35. file:
  36. state: link
  37. src: "{{ tox_executable }}"
  38. dest: /usr/local/bin/tox
  39. become: yes