mirror of
https://github.com/famedly/ansible-collection-base
synced 2024-11-10 06:24:17 +00:00
refactor(pip): rewrite pip-role
This commit is contained in:
parent
a2fca9941c
commit
69ab727648
4 changed files with 38 additions and 4 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,6 +1,3 @@
|
||||||
[submodule "roles/docker"]
|
[submodule "roles/docker"]
|
||||||
path = roles/docker
|
path = roles/docker
|
||||||
url = https://github.com/geerlingguy/ansible-role-docker.git
|
url = https://github.com/geerlingguy/ansible-role-docker.git
|
||||||
[submodule "roles/pip"]
|
|
||||||
path = roles/pip
|
|
||||||
url = https://github.com/geerlingguy/ansible-role-pip.git
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit a2c8e54a569d3b3bd92268d6daa0418da123733f
|
|
12
roles/pip/defaults/main.yml
Normal file
12
roles/pip/defaults/main.yml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
# For Python 3, use python3-pip.
|
||||||
|
pip_package_name: python3-pip
|
||||||
|
pip_executable: "{{ 'pip3' if pip_package_name.startswith('python3') else 'pip' }}"
|
||||||
|
pip_executable_extra_args: ~
|
||||||
|
pip_environment_variables: {}
|
||||||
|
|
||||||
|
pip_packages: []
|
||||||
|
|
||||||
|
pip_requirements_file: ~
|
||||||
|
pip_package_state: present
|
||||||
|
pip_package_virtualenv: ~
|
26
roles/pip/tasks/main.yml
Normal file
26
roles/pip/tasks/main.yml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
---
|
||||||
|
- name: Ensure Pip is installed.
|
||||||
|
package:
|
||||||
|
name: "{{ pip_package_name }}"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Install packages from list
|
||||||
|
pip:
|
||||||
|
name: "{{ item.name | default(item) }}"
|
||||||
|
version: "{{ item.version | default(omit) }}"
|
||||||
|
virtualenv: "{{ item.virtualenv | default(omit) }}"
|
||||||
|
state: "{{ item.state | default(omit) }}"
|
||||||
|
executable: "{{ pip_executable }}"
|
||||||
|
extra_args: "{{ pip_executable_extra_args | default(omit) }}"
|
||||||
|
loop: "{{ pip_packages }}"
|
||||||
|
environment: "{{ pip_environment_variables }}"
|
||||||
|
|
||||||
|
- name: Install packages from requirements file
|
||||||
|
pip:
|
||||||
|
requirements: "{{ pip_requirements_file }}"
|
||||||
|
virtualenv: "{{ pip_package_virtualenv | default(omit) }}"
|
||||||
|
state: "{{ pip_package_state | default(omit) }}"
|
||||||
|
executable: "{{ pip_executable }}"
|
||||||
|
extra_args: "{{ pip_executable_extra_args | default(omit) }}"
|
||||||
|
when: "pip_requirements_file"
|
||||||
|
environment: "{{ pip_environment_variables }}"
|
Loading…
Reference in a new issue