-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d9f2a3
commit 88f48e8
Showing
8 changed files
with
166 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
# defaults file | ||
--- | ||
pip_python_version_major: 2 | ||
pip_install_method: native | ||
# Only available for < 24.04 | ||
# pip_install_method: get-pip | ||
|
||
pip_python_version_major: 3 | ||
pip_python_version: "{{ pip_python_version_major }}" | ||
|
||
pip_install: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# tasks file | ||
--- | ||
- name: install | get-pip | install dependencies | ||
ansible.builtin.apt: | ||
name: "{{ pip_install_get_pip_dependencies }}" | ||
state: "{{ apt_install_state | default('latest') }}" | ||
update_cache: true | ||
cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}" | ||
tags: | ||
- pip-install-get-pip-dependencies | ||
|
||
- name: install | get-pip | create (download) directory | ||
ansible.builtin.file: | ||
path: "{{ pip_install_get_pip_download_path }}" | ||
state: directory | ||
owner: root | ||
group: root | ||
mode: 0755 | ||
tags: | ||
- pip-install-get-pip-directory | ||
|
||
- name: install | get-pip | get python version # noqa risky-shell-pipe | ||
ansible.builtin.shell: > | ||
python{{ pip_python_version_major | string }} --version 2>&1 | awk '{print $2}' | ||
register: _python_version | ||
changed_when: false | ||
tags: | ||
- pip-install-get-pip-get-python-version | ||
|
||
- name: install | get-pip | get download url | ||
tags: | ||
- pip-install-get-pip-get-download-url | ||
block: | ||
- name: install | get-pip | get download url (2.6) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/2.6/get-pip.py' | ||
when: | ||
- _python_version.stdout is version('2.6', '>=') | ||
- _python_version.stdout is version('2.7', '<') | ||
|
||
- name: install | get-pip | get download url (2.7) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/2.7/get-pip.py' | ||
when: | ||
- _python_version.stdout is version('2.7', '>=') | ||
- _python_version.stdout is version('2.8', '<') | ||
|
||
- name: install | get-pip | get download url (3.2) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/3.2/get-pip.py' | ||
when: | ||
- _python_version.stdout is version('3.2', '>=') | ||
- _python_version.stdout is version('3.3', '<') | ||
|
||
- name: install | get-pip | get download url (3.3) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/3.3/get-pip.py' | ||
when: | ||
- _python_version.stdout is version('3.3', '>=') | ||
- _python_version.stdout is version('3.4', '<') | ||
|
||
- name: install | get-pip | get download url (3.4) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/3.4/get-pip.py' | ||
when: | ||
- _python_version.stdout is version('3.4', '>=') | ||
- _python_version.stdout is version('3.5', '<') | ||
|
||
- name: install | get-pip | get download url (3.5) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/3.5/get-pip.py' | ||
when: | ||
- _python_version.stdout is version('3.5', '>=') | ||
- _python_version.stdout is version('3.6', '<') | ||
|
||
- name: install | get-pip | get download url (3.6) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/3.6/get-pip.py' | ||
when: | ||
- _python_version.stdout is version('3.6', '>=') | ||
- _python_version.stdout is version('3.7', '<') | ||
|
||
- name: install | get-pip | get download url (3.7) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/3.7/get-pip.py' | ||
when: | ||
- _python_version.stdout is version('3.7', '>=') | ||
- _python_version.stdout is version('3.8', '<') | ||
|
||
- name: install | get-pip | get download url (latest) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/get-pip.py' | ||
when: _python_version.stdout is version('3.8', '>=') | ||
|
||
- name: install | get-pip | download (latest) | ||
ansible.builtin.get_url: | ||
url: "{{ pip_download_url }}" | ||
dest: "{{ pip_install_get_pip_download_path }}/{{ pip_download_url | basename }}-{{ pip_python_version_major | string }}" | ||
owner: root | ||
group: root | ||
mode: 0644 | ||
force: true | ||
register: _download_latest | ||
tags: | ||
- pip-install-get-pip-download | ||
|
||
- name: install | get-pip | install (latest) | ||
ansible.builtin.command: > | ||
python{{ pip_python_version_major | string }} {{ _download_latest.dest }} | ||
when: _download_latest is changed | ||
changed_when: true | ||
tags: | ||
- pip-install-get-pip-install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# tasks file | ||
--- | ||
- name: install | native | dependencies | ||
ansible.builtin.apt: | ||
name: "{{ pip_install_native_dependencies }}" | ||
state: "{{ apt_install_state | default('latest') }}" | ||
update_cache: true | ||
cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}" | ||
tags: | ||
- pip-install-native-dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,125 +1,37 @@ | ||
# tasks file | ||
--- | ||
- name: install dependencies | ||
ansible.builtin.apt: | ||
name: "{{ pip_dependencies }}" | ||
state: "{{ apt_install_state | default('latest') }}" | ||
update_cache: true | ||
cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}" | ||
tags: | ||
- configuration | ||
- pip | ||
- pip-dependencies | ||
|
||
- name: create (download) directory | ||
ansible.builtin.file: | ||
path: "{{ pip_download_path }}" | ||
state: directory | ||
owner: root | ||
group: root | ||
mode: 0755 | ||
tags: | ||
- configuration | ||
- pip | ||
- pip-directory | ||
|
||
- name: get python version # noqa risky-shell-pipe | ||
ansible.builtin.shell: > | ||
python{{ pip_python_version_major | string }} --version 2>&1 | awk '{print $2}' | ||
register: _python_version | ||
changed_when: false | ||
- name: install native | ||
ansible.builtin.import_tasks: install-native.yml | ||
when: pip_install_method == 'native' | ||
tags: | ||
- configuration | ||
- pip | ||
- pip-get-python-version | ||
- pip-install-native | ||
|
||
- name: get download url | ||
- name: install pip | ||
ansible.builtin.import_tasks: install-get-pip.yml | ||
when: pip_install_method == 'get-pip' | ||
tags: | ||
- configuration | ||
- pip | ||
- pip-get-download-url | ||
block: | ||
- name: get download url (2.6) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/2.6/get-pip.py' | ||
when: | ||
- _python_version.stdout is version('2.6', '>=') | ||
- _python_version.stdout is version('2.7', '<') | ||
- pip-install-get-pip | ||
|
||
- name: get download url (2.7) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/2.7/get-pip.py' | ||
when: | ||
- _python_version.stdout is version('2.7', '>=') | ||
- _python_version.stdout is version('2.8', '<') | ||
|
||
- name: get download url (3.2) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/3.2/get-pip.py' | ||
when: | ||
- _python_version.stdout is version('3.2', '>=') | ||
- _python_version.stdout is version('3.3', '<') | ||
|
||
- name: get download url (3.3) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/3.3/get-pip.py' | ||
when: | ||
- _python_version.stdout is version('3.3', '>=') | ||
- _python_version.stdout is version('3.4', '<') | ||
|
||
- name: get download url (3.4) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/3.4/get-pip.py' | ||
when: | ||
- _python_version.stdout is version('3.4', '>=') | ||
- _python_version.stdout is version('3.5', '<') | ||
|
||
- name: get download url (3.5) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/3.5/get-pip.py' | ||
when: | ||
- _python_version.stdout is version('3.5', '>=') | ||
- _python_version.stdout is version('3.6', '<') | ||
|
||
- name: get download url (3.6) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/3.6/get-pip.py' | ||
when: | ||
- _python_version.stdout is version('3.6', '>=') | ||
- _python_version.stdout is version('3.7', '<') | ||
|
||
- name: get download url (3.7) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/3.7/get-pip.py' | ||
when: | ||
- _python_version.stdout is version('3.7', '>=') | ||
- _python_version.stdout is version('3.8', '<') | ||
|
||
- name: get download url (latest) | ||
ansible.builtin.set_fact: | ||
pip_download_url: 'https://bootstrap.pypa.io/pip/get-pip.py' | ||
when: _python_version.stdout is version('3.8', '>=') | ||
|
||
- name: download (latest) pip | ||
ansible.builtin.get_url: | ||
url: "{{ pip_download_url }}" | ||
dest: "{{ pip_download_path }}/{{ pip_download_url | basename }}-{{ pip_python_version_major | string }}" | ||
owner: root | ||
group: root | ||
mode: 0644 | ||
force: true | ||
register: _download_latest | ||
- name: install additional | ||
ansible.builtin.apt: | ||
name: "{{ pip_install }}" | ||
state: "{{ apt_install_state | default('latest') }}" | ||
tags: | ||
- configuration | ||
- pip | ||
- pip-pip-download | ||
- pip-install | ||
- pip-install-additional | ||
|
||
- name: install (latest) pip (setuptools and wheel) | ||
- name: verify | ||
ansible.builtin.command: > | ||
python{{ pip_python_version_major | string }} {{ _download_latest.dest }} | ||
when: _download_latest is changed | ||
changed_when: true | ||
pip --version | ||
changed_when: false | ||
tags: | ||
- configuration | ||
- pip | ||
- pip-pip-install | ||
- pip-install | ||
- pip-install-verify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# vars file | ||
--- | ||
pip_python_version_major: 3 | ||
pip_install_method: native |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# vars file | ||
--- | ||
pip_install_method: get-pip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
# vars file | ||
--- | ||
pip_dependencies: | ||
pip_install_native_dependencies: | ||
- "python{{ pip_python_version_major is version('3', '>=') | ternary('3', '') }}-pip" | ||
|
||
pip_install_get_pip_dependencies: | ||
- "python{{ pip_python_version_major is version('3', '>=') | ternary('3', '') }}" | ||
- "python{{ pip_python_version_major is version('3', '>=') | ternary('3', '') }}-dev" | ||
- curl | ||
|
||
pip_download_path: /var/lib/ansible/pip/downloads | ||
pip_install_get_pip_download_path: /var/lib/ansible/pip/downloads |