Skip to content

Commit ddf9c55

Browse files
author
Colin Hoglund
committed
add travis tests, update documentation
1 parent 45b72cd commit ddf9c55

File tree

5 files changed

+127
-49
lines changed

5 files changed

+127
-49
lines changed

.travis.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
language: python
3+
python: "2.7"
4+
5+
# Use the new container infrastructure
6+
sudo: false
7+
8+
# Install ansible
9+
addons:
10+
apt:
11+
packages:
12+
- python-pip
13+
14+
install:
15+
# Install ansible
16+
- pip install ansible
17+
18+
# Check ansible version
19+
- ansible --version
20+
21+
# Create ansible.cfg with correct roles_path
22+
- printf '[defaults]\nroles_path=../' >ansible.cfg
23+
24+
script:
25+
# Basic role syntax check
26+
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
27+
28+
notifications:
29+
webhooks: https://galaxy.ansible.com/api/v1/notifications/

README.md

Lines changed: 76 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,83 @@
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+
----------------
236

337
Install default OS package:
4-
```
5-
---
638

7-
- hosts: all
8-
become: true
9-
roles:
10-
- python
11-
```
39+
---
40+
41+
- hosts: all
42+
become: true
43+
roles:
44+
- python
1245

1346
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
2658

2759
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

meta/main.yml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
---
21
dependencies: []
3-
42
galaxy_info:
5-
author: Colin Hoglund
6-
description: Python Ansible role that supports package installs as well as building from source.
7-
license: "license (BSD, MIT)"
8-
min_ansible_version: 1.9
3+
author: SinglePlatform Engineering (http://engineering.singleplatform.com/)
4+
company: SinglePlatform (http://www.singleplatform.com/)
5+
license: BSD 3-Clause
6+
7+
min_ansible_version: 2.1
98
platforms:
10-
- name: Debian
11-
versions:
12-
- all
13-
- name: Ubuntu
14-
versions:
15-
- all
16-
categories:
17-
- development
9+
- name: Ubuntu
10+
versions:
11+
- all
12+
- name: Debian
13+
versions:
14+
- all
15+
16+
galaxy_tags:
17+
- security
18+
- logrhythm
19+
- logging

tests/inventory

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
localhost

tests/test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- hosts: localhost
3+
remote_user: root
4+
roles:
5+
- ansible-role-python

0 commit comments

Comments
 (0)