Skip to content

Commit 6cb4374

Browse files
bellackntobias-richter
authored andcommitted
Add support for Python3 (#16)
* Add support for Python3 * Raise minimal Ansible version to 2.5
1 parent 306cc9c commit 6cb4374

File tree

6 files changed

+24
-8
lines changed

6 files changed

+24
-8
lines changed

.travis.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
---
22
language: python
33
cache: pip
4-
python: "2.7"
4+
python:
5+
- "2.7"
6+
- "3.5"
7+
- "3.6"
8+
- "3.7"
59
env:
610
# run against latest version
711
- ANSIBLE_VERSION=latest
812
# run against minimal required version
9-
- ANSIBLE_VERSION=2.4.*
13+
- ANSIBLE_VERSION=2.5.*
1014

1115
# Use the new container infrastructure
1216
sudo: false
@@ -16,10 +20,13 @@ addons:
1620
apt:
1721
packages:
1822
- python-pip
23+
- python-setuptools
24+
- python3-pip
25+
- python3-setuptools
1926

2027
install:
2128
# Install ansible and dependencies
22-
- if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install ansible ansible-lint --upgrade; else pip install ansible=="$ANSIBLE_VERSION" ansible-lint --upgrade; fi
29+
- PIP=$(which pip3 || which pip); if [ "$ANSIBLE_VERSION" = "latest" ]; then "$PIP" install ansible ansible-lint --upgrade; else "$PIP" install ansible=="$ANSIBLE_VERSION" ansible-lint --upgrade; fi
2330

2431
# Check ansible version
2532
- ansible --version

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ block of the maven settings.
182182

183183
When set the given version of Ansible will be installed on the controlhost.
184184

185+
controlhost_python_version: 3
186+
187+
Controls if Python3 or Python2 will be installed. The exact version depends on the host's OS.
188+
185189
controlhost_packages_pip_upgrade: true
186190

187191
Controls if pip will be executed using the --upgrade option.

defaults/main.yml

+3
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ controlhost_maven_mirrors: []
9393
# When set the given version of Ansible will be installed on the controlhost
9494
#controlhost_ansible_version: 2.5.6
9595

96+
# Use either 2 for Python2 or 3 for Python3 here
97+
controlhost_python_version: 3
98+
9699
# Controls if pip will be executed using the --upgrade option
97100
controlhost_packages_pip_upgrade: true
98101

meta/main.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ galaxy_info:
55
company: pro!vision
66
issue_tracker_url: https://wcm-io.atlassian.net
77
license: Apache
8-
min_ansible_version: 2.4
8+
min_ansible_version: 2.5
99

1010
platforms:
1111
- name: EL
1212
versions:
1313
- 7
14+
- 8
1415
- name: Debian
1516
versions:
1617
- stretch
18+
- buster
1719

1820
galaxy_tags:
1921
- aem

vars/family_Debian.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ __controlhost_packages_os:
33
- iftop
44
- htop
55
- iotop
6-
- python2.7
7-
- python-pip
6+
- "{{ 'python2.7' if controlhost_python_version == '2' else 'python3' }}"
7+
- "{{ 'python-pip' if controlhost_python_version == '2' else 'python3-pip' }}"
88
- git
99
- sshpass
1010
- wget

vars/family_RedHat.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ __controlhost_packages_os:
33
- iftop
44
- htop
55
- iotop
6-
- python
7-
- python2-pip
6+
- "{{ 'python' if controlhost_python_version == '2' else 'python3' }}"
7+
- "{{ 'python-pip' if controlhost_python_version == '2' else 'python3-pip' }}"
88
- git
99
- sshpass
1010
- wget

0 commit comments

Comments
 (0)