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 7178dbf commit ca2a896
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
skip_list:
- '403'
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
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 virtualenv
---
virtualenv_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 @@ -16,8 +16,8 @@
pip:
name: "{{ virtualenv_pip_dependencies }}"
state: latest
executable: "pip{{ virtualenv_python_version | string }}"
tags:
- configuration
- virtualenv
- virtualenv-install
- skip_ansible_lint
6 changes: 3 additions & 3 deletions tests/pre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
- name: pre | install dependencies
apt:
name:
- python
- curl
- "python{{ virtualenv_python_version is version('3', '>=') | ternary('3', '') }}"
- curl
state: "{{ apt_install_state | default('latest') }}"
update_cache: true
cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}"

- name: pre | install pip
shell: >
curl -sL https://bootstrap.pypa.io/get-pip.py | python -
curl -sL https://bootstrap.pypa.io/get-pip.py | python{{ virtualenv_python_version | string }} -
args:
warn: false
changed_when: false
2 changes: 2 additions & 0 deletions tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
- include: pre.yml
roles:
- ../../
# vars:
# virtualenv_python_version: 3
2 changes: 1 addition & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# vars file for virtualenv
---
virtualenv_dependencies:
- python
- "python{{ virtualenv_python_version is version('3', '>=') | ternary('3', '') }}"

virtualenv_pip_dependencies:
- virtualenv
Expand Down

0 comments on commit ca2a896

Please sign in to comment.