|
1 |
| -In addition to installing Python, this role also installs `pip` and `virtualenv` globally. |
| 1 | + |
| 2 | +ansible-role-python |
| 3 | +========= |
| 4 | + |
| 5 | +Ansible role for installing and configuring Python, pip, and virtualenv. |
| 6 | + |
| 7 | +https://galaxy.ansible.com/singleplatform-eng/python/ |
| 8 | + |
| 9 | +Role Variables |
| 10 | +-------------- |
| 11 | + |
| 12 | +- `logrhythm_host`: host for Mediator 1 (this is required, unless you override the entire `logrhythm_config`) |
| 13 | + |
| 14 | +- `python_apt_key_url`: apt key for installing custom python package (Default: '') |
| 15 | +- `python_apt_repo`: apt repo for installing custom python package (Default: '') |
| 16 | +- `python_global_packages`: pip packages to install globally (Default: []) |
| 17 | +- `python_package_name`: name of python package (Default: python) |
| 18 | + |
| 19 | +- `python_pip_config`: glocal pip.conf configuration (Default: undefined) |
| 20 | + |
| 21 | + # Example |
| 22 | + global: |
| 23 | + index-url: http://pypi.example.com/simple |
| 24 | + find-links: |
| 25 | + - http://pypi2.example.com/simple |
| 26 | + - http://pypi3.example.com/simple |
| 27 | + search: |
| 28 | + index: http://pypi.example.com/simple |
| 29 | + |
| 30 | +- `python_build_from_source`: whether to build from source or install package (Default: false) |
| 31 | +- `python_configure_prefix`: directory to install to when building from source (Default: /usr/local) |
| 32 | +- `python_version`: version of python to build (Default: '') |
| 33 | + |
| 34 | +Example Playbook |
| 35 | +---------------- |
2 | 36 |
|
3 | 37 | Install default OS package:
|
4 |
| -``` |
5 |
| ---- |
6 | 38 |
|
7 |
| -- hosts: all |
8 |
| - become: true |
9 |
| - roles: |
10 |
| - - python |
11 |
| -``` |
| 39 | + --- |
| 40 | + |
| 41 | + - hosts: all |
| 42 | + become: true |
| 43 | + roles: |
| 44 | + - python |
12 | 45 |
|
13 | 46 | Install custom package:
|
14 |
| -``` |
15 |
| ---- |
16 |
| -
|
17 |
| -- hosts: all |
18 |
| - become: true |
19 |
| - vars: |
20 |
| - python_apt_repo: deb http://example.repo/ trusty main |
21 |
| - python_apt_key_url: https://example.repo/Release.key |
22 |
| - python_package_name: python-custom |
23 |
| - roles: |
24 |
| - - python |
25 |
| -``` |
| 47 | + |
| 48 | + --- |
| 49 | + |
| 50 | + - hosts: all |
| 51 | + become: true |
| 52 | + vars: |
| 53 | + python_apt_repo: deb http://example.repo/ trusty main |
| 54 | + python_apt_key_url: https://example.repo/Release.key |
| 55 | + python_package_name: python-custom |
| 56 | + roles: |
| 57 | + - python |
26 | 58 |
|
27 | 59 | Build Python 2 and 3 from source with custom prefix and global packages:
|
28 |
| -``` |
29 |
| ---- |
30 |
| -
|
31 |
| -- hosts: all |
32 |
| - become: true |
33 |
| - vars: |
34 |
| - python_build_from_source: true |
35 |
| - python_configure_prefix: /opt/local |
36 |
| - python_global_packages: |
37 |
| - - ansible==2.0.1.0 |
38 |
| - - uwsgi |
39 |
| - roles: |
40 |
| - - { role: python, python_version: 2.7.7 } |
41 |
| - - { role: python, python_version: 3.4.4 } |
42 |
| -``` |
| 60 | + |
| 61 | + --- |
| 62 | + |
| 63 | + - hosts: all |
| 64 | + become: true |
| 65 | + vars: |
| 66 | + python_build_from_source: true |
| 67 | + python_configure_prefix: /opt/local |
| 68 | + python_global_packages: |
| 69 | + - ansible==2.0.1.0 |
| 70 | + - uwsgi |
| 71 | + roles: |
| 72 | + - { role: python, python_version: 2.7.7 } |
| 73 | + - { role: python, python_version: 3.4.4 } |
| 74 | + |
| 75 | +Author Information |
| 76 | +------------------ |
| 77 | + |
| 78 | +[SinglePlatform Engineering](http://engineering.singleplatform.com/) |
| 79 | + |
| 80 | +License |
| 81 | +------- |
| 82 | + |
| 83 | +BSD 3-Clause |
0 commit comments