Skip to content

Commit

Permalink
Add Python 3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
tersmitten committed Jun 16, 2020
1 parent 43f19a1 commit 4a73097
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 7 deletions.
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu:16.04
MAINTAINER Mischa ter Smitten <[email protected]>

# python
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y python-minimal python-dev curl && \
apt-get clean
RUN curl -sL https://bootstrap.pypa.io/get-pip.py | python -
RUN rm -rf $HOME/.cache

# ansible
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y gcc libffi-dev libssl-dev && \
apt-get clean
RUN pip install ansible==2.6.2
RUN rm -rf $HOME/.cache

# provision
COPY . /etc/ansible/roles/ansible-role
WORKDIR /etc/ansible/roles/ansible-role
RUN ansible-playbook -i tests/inventory tests/test.yml --connection=local
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
## pip

[![Build Status](https://travis-ci.org/Oefenweb/ansible-pip.svg?branch=master)](https://travis-ci.org/Oefenweb/ansible-pip) [![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-pip-blue.svg)](https://galaxy.ansible.com/Oefenweb/pip)
[![Build Status](https://travis-ci.org/Oefenweb/ansible-pip.svg?branch=master)](https://travis-ci.org/Oefenweb/ansible-pip)
[![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-pip-blue.svg)](https://galaxy.ansible.com/Oefenweb/pip)

Set up (the latest version of) [pip](https://pypi.python.org/pypi/pip), [wheel](https://packaging.python.org/key_projects/#wheel) and [setuptools](https://packaging.python.org/key_projects/#setuptools) in Debian-like systems.

#### Requirements

* `python` (will be installed)
* `python-dev` (will be installed)
* `python(2|3)` (will be installed)
* `python(2|3)-dev` (will be installed)
* `curl` (will be installed)

#### Variables

None
* `pip_python_version` [default: `2`]: Python version to install `pip` (and `setuptools`) for.

## Dependencies

Expand Down
7 changes: 7 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ boxes = [
:cpu => "50",
:ram => "256"
},
{
:name => "debian-10",
:box => "bento/debian-10",
:ip => '10.0.0.18',
:cpu => "50",
:ram => "256"
},
]

Vagrant.configure("2") do |config|
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# defaults file for pip
---
pip_python_version: 2
1 change: 1 addition & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ galaxy_info:
- wheezy
- jessie
- stretch
- buster
galaxy_tags:
- development
- system
Expand Down
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

- name: install (latest) pip (setuptools and wheel)
command: >
python {{ _download_latest.dest }}
python{{ pip_python_version | string }} {{ _download_latest.dest }}
when: _download_latest is changed
tags:
- configuration
Expand Down
4 changes: 2 additions & 2 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# vars file for pip
---
pip_dependencies:
- python
- python-dev
- "python{{ pip_python_version is version('3', '>=') | ternary('3', '') }}"
- "python{{ pip_python_version is version('3', '>=') | ternary('3', '') }}-dev"
- curl

pip_download_path: /var/lib/ansible/pip/downloads
Expand Down

0 comments on commit 4a73097

Please sign in to comment.