Allow setting pip_proxy

Change-Id: I2547ef2556ca96b614854515069aaca3349cd692
This commit is contained in:
Michal Nasiadka 2020-02-24 19:24:50 +01:00
parent 2e842ab3f5
commit a0ab81d752
6 changed files with 42 additions and 13 deletions

View File

@ -16,3 +16,5 @@ pip_index_url: ""
# disabled
pip_trusted_hosts: []
# Optional: proxy configuration
pip_proxy: ""

View File

@ -1,6 +1,6 @@
---
- include_tasks: pip_local_mirror.yml
- include_tasks: pip_conf.yml
loop: "{{ pip_applicable_users }}"
loop_control:
loop_var: user
when: pip_local_mirror | bool
when: (pip_local_mirror | bool) or (pip_proxy | length > 0)

View File

@ -17,6 +17,9 @@
{{ host }}
{% endfor -%}
{% endif -%}
{% if pip_proxy | length > 0 -%}
proxy = {{ pip_proxy }}
{% endif -%}
dest: "~{{ user}}/.pip/pip.conf"
become: True
become_user: "{{ user }}"

View File

@ -94,21 +94,27 @@ For example, to set the bootstrap user for controllers to ``centos``:
controller_bootstrap_user: centos
PyPI Mirror
===========
PyPI Mirror and proxy
=====================
*tags:*
| ``pip``
Kayobe supports configuration of a PyPI mirror, via variables in
``${KAYOBE_CONFIG_PATH}/pip.yml``. This functionality is enabled by setting the
``pip_local_mirror`` variable to ``true``.
Kayobe supports configuration of a PyPI mirror and/or proxy, via variables in
``${KAYOBE_CONFIG_PATH}/pip.yml``.
Mirror functionality is enabled by setting the ``pip_local_mirror`` variable to
``true`` and proxy functionality is enabled by setting ``pip_proxy`` variable
to a proxy URL.
Kayobe will generate configuration for
``pip`` and ``easy_install`` to use the mirror, for the list of users defined
by ``pip_applicable_users`` (default ``kayobe_ansible_user`` and ``root``), in
addition to the user used for Kolla Ansible (``kolla_ansible_user``). The
mirror URL is configured via ``pip_index_url``, and ``pip_trusted_hosts`` is a
list of 'trusted' hosts, for which SSL verification will be disabled.
Kayobe will generate configuration for:
* ``pip`` to use the mirror and proxy
* ``easy_install`` to use the mirror
for the list of users defined by ``pip_applicable_users`` (default
``kayobe_ansible_user`` and ``root``), in addition to the user used for Kolla
Ansible (``kolla_ansible_user``). The mirror URL is configured via
``pip_index_url``, and ``pip_trusted_hosts`` is a list of 'trusted' hosts, for
which SSL verification will be disabled.
For example, to configure use of the test PyPI mirror at
https://test.pypi.org/simple/:
@ -119,6 +125,14 @@ https://test.pypi.org/simple/:
pip_local_mirror: true
pip_index_url: https://test.pypi.org/simple/
To configure use of the PyPI proxy:
.. code-block:: yaml
:caption: ``pip.yml``
pip_proxy: http://your_proxy_server:3128
Kayobe Remote Virtual Environment
=================================
*tags:*

View File

@ -23,6 +23,9 @@
# disabled
#pip_trusted_hosts: []
# PyPI proxy URL (format: http(s)://[user:password@]proxy_name:port)
#pip_proxy: ""
###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes

View File

@ -0,0 +1,7 @@
---
features:
- |
Introduces a new option - ``pip_proxy`` - to configure Pip package
installation via a user-defined http(s) proxy. This is set on a per-user
basis, and by default this is for the same users as pip_local_mirror
feature.