Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ python_apt_repo: ''
python_global_packages: []
python_package_name: python

# Example pip configuration
#python_pip_config:
# global:
# index-url: http://pypi.example.com/simple
# find-links:
# - http://pypi2.example.com/simple
# - http://pypi3.example.com/simple
# search:
# index: http://pypi.example.com/simple

# Build defaults
python_build_from_source: false
python_configure_prefix: '/usr/local'
Expand Down
9 changes: 9 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
- name: Upgrade pip
pip: name=pip state=latest executable="{{python_pip_path}}"

- name: Add system pip.conf
template:
src: pip.conf.j2
dest: /etc/pip.conf
owner: root
group: root
mode: 0644
when: python_pip_config is defined

# Install packages
- name: Install/upgrade virtualenv
pip: name=virtualenv state=latest executable="{{python_pip_path}}"
Expand Down
13 changes: 13 additions & 0 deletions templates/pip.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% for section,config in python_pip_config.iteritems() | sort %}
[{{section}}]
{% for k,v in config.iteritems() | sort %}
{% if v is iterable and v is not string %}
{{k}} =
{% for item in v %}
{{item}}
{% endfor %}
{% else %}
{{k}} = {{v}}
{% endif %}
{% endfor %}
{% endfor %}