Skip to content

Commit 5ad2d6d

Browse files
committed
Install pip/pymongo based on Python version
1 parent 7fc9162 commit 5ad2d6d

File tree

7 files changed

+57
-25
lines changed

7 files changed

+57
-25
lines changed

.github/workflows/amazonlinux2.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- master
1010

1111
jobs:
12-
python2:
12+
python3:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
@@ -29,9 +29,21 @@ jobs:
2929
run: pip install -r requirements.txt
3030
- name: Run default test
3131
run: molecule test
32+
env:
33+
PY_COLORS: '1'
34+
ANSIBLE_FORCE_COLOR: '1'
3235
- name: Run default test with enabled authentication
3336
run: AUTH_STATE=enabled molecule test
37+
env:
38+
PY_COLORS: '1'
39+
ANSIBLE_FORCE_COLOR: '1'
3440
- name: Run cluster test
3541
run: molecule test -s cluster
42+
env:
43+
PY_COLORS: '1'
44+
ANSIBLE_FORCE_COLOR: '1'
3645
- name: Run cluster test with enabled authentication
3746
run: AUTH_STATE=enabled molecule test -s cluster
47+
env:
48+
PY_COLORS: '1'
49+
ANSIBLE_FORCE_COLOR: '1'

.github/workflows/centos.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- master
1010

1111
jobs:
12-
python2:
12+
python3:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
@@ -30,9 +30,21 @@ jobs:
3030
run: pip install -r requirements.txt
3131
- name: Run default test
3232
run: molecule test
33+
env:
34+
PY_COLORS: '1'
35+
ANSIBLE_FORCE_COLOR: '1'
3336
- name: Run default test with enabled authentication
3437
run: AUTH_STATE=enabled molecule test
38+
env:
39+
PY_COLORS: '1'
40+
ANSIBLE_FORCE_COLOR: '1'
3541
- name: Run cluster test
3642
run: molecule test -s cluster
43+
env:
44+
PY_COLORS: '1'
45+
ANSIBLE_FORCE_COLOR: '1'
3746
- name: Run cluster test with enabled authentication
3847
run: AUTH_STATE=enabled molecule test -s cluster
48+
env:
49+
PY_COLORS: '1'
50+
ANSIBLE_FORCE_COLOR: '1'

.github/workflows/debian.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- master
1010

1111
jobs:
12-
python2:
12+
python3:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
@@ -35,9 +35,21 @@ jobs:
3535
run: pip install -r requirements.txt
3636
- name: Run default test
3737
run: molecule test
38+
env:
39+
PY_COLORS: '1'
40+
ANSIBLE_FORCE_COLOR: '1'
3841
- name: Run default test with enabled authentication
3942
run: AUTH_STATE=enabled molecule test
43+
env:
44+
PY_COLORS: '1'
45+
ANSIBLE_FORCE_COLOR: '1'
4046
- name: Run cluster test
4147
run: molecule test -s cluster
48+
env:
49+
PY_COLORS: '1'
50+
ANSIBLE_FORCE_COLOR: '1'
4251
- name: Run cluster test with enabled authentication
4352
run: AUTH_STATE=enabled molecule test -s cluster
53+
env:
54+
PY_COLORS: '1'
55+
ANSIBLE_FORCE_COLOR: '1'

vars/Amazon.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ mongodb_pidfile_path: "{{ '/var/run/mongodb/mongod.pid' if ('mongodb-org' in mon
1313

1414
yum_lock_timeout: 180
1515

16-
mongodb_pymongo_package: "{{ 'python3-pymongo' if ansible_python_interpreter is search('python3') | bool else 'python-pymongo' }}"
16+
mongodb_pymongo_package: "{{ 'python3-pymongo' if ansible_facts['python'].version.major == 3 else 'python-pymongo' }}"
1717
mongodb_pymongo_deps:
18-
- "{{ 'python3-devel' if ansible_python_interpreter is search('python3') | bool else 'python-devel' }}"
19-
- "{{ 'python3-pip' if ansible_python_interpreter is search('python3') | bool else 'python-pip' }}"
20-
mongodb_pip_executable: "{{ 'pip3' if ansible_python_interpreter is search('python3') | bool else 'pip' }}"
21-
18+
- "{{ 'python3-devel' if ansible_facts['python'].version.major == 3 else 'python-devel' }}"
19+
- "{{ 'python3-pip' if ansible_facts['python'].version.major == 3 else 'python-pip' }}"
20+
mongodb_pip_executable: "{{ 'pip3' if ansible_facts['python'].version.major == 3 else 'pip' }}"

vars/Debian.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ mongodb_repository:
44
"4.0": "deb http://repo.mongodb.org/apt/debian {{ ansible_distribution_release }}/mongodb-org/4.0 main"
55
"4.2": "deb http://repo.mongodb.org/apt/debian {{ ansible_distribution_release }}/mongodb-org/4.2 main"
66

7-
mongodb_pymongo_package: "{{ 'python3-pymongo' if ansible_python_interpreter is search('python3') | bool else 'python-pymongo' }}"
7+
mongodb_pymongo_package: "{{ 'python3-pymongo' if ansible_facts['python'].version.major == 3 else 'python-pymongo' }}"
88
mongodb_pymongo_deps:
9-
- "{{ 'python3-dev' if ansible_python_interpreter is search('python3') | bool else 'python-dev' }}"
10-
- "{{ 'python3-pip' if ansible_python_interpreter is search('python3') | bool else 'python-pip' }}"
11-
mongodb_python_setuptools: "{{ 'python3-setuptools' if ansible_python_interpreter is search('python3') | bool else 'python-setuptools' }}"
12-
mongodb_pip_executable: "{{ 'pip3' if ansible_python_interpreter is search('python3') | bool else 'pip' }}"
13-
9+
- "{{ 'python3-dev' if ansible_facts['python'].version.major == 3 else 'python-dev' }}"
10+
- "{{ 'python3-pip' if ansible_facts['python'].version.major == 3 else 'python-pip' }}"
11+
mongodb_python_setuptools: "{{ 'python3-setuptools' if ansible_facts['python'].version.major == 3 else 'python-setuptools' }}"
12+
mongodb_pip_executable: "{{ 'pip3' if ansible_facts['python'].version.major == 3 else 'pip' }}"

vars/RedHat.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ mongodb_pidfile_path: "{{ '/var/run/mongodb/mongod.pid' if ('mongodb-org' in mon
1313

1414
yum_lock_timeout: 180
1515

16-
mongodb_pymongo_package: "{{ 'python3-pymongo' if ansible_python_interpreter is search('python3') | bool else 'python-pymongo' }}"
16+
mongodb_pymongo_package: "{{ 'python3-pymongo' if ansible_facts['python'].version.major == 3 else 'python-pymongo' }}"
1717
mongodb_pymongo_deps:
18-
- "{{ 'python3-devel' if ansible_python_interpreter is search('python3') | bool else 'python-devel' }}"
19-
- "{{ 'python3-pip' if ansible_python_interpreter is search('python3') | bool else 'python-pip' }}"
20-
mongodb_pip_executable: "{{ 'pip3' if ansible_python_interpreter is search('python3') | bool else 'pip' }}"
21-
18+
- "{{ 'python3-devel' if ansible_facts['python'].version.major == 3 else 'python-devel' }}"
19+
- "{{ 'python3-pip' if ansible_facts['python'].version.major == 3 else 'python-pip' }}"
20+
mongodb_pip_executable: "{{ 'pip3' if ansible_facts['python'].version.major == 3 else 'pip' }}"

vars/Ubuntu.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ mongodb_repository:
44
"4.0": "deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/4.0 multiverse"
55
"4.2": "deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/4.2 multiverse"
66

7-
mongodb_pymongo_package: "{{ 'python3-pymongo' if ansible_python_interpreter is search('python3') | bool else 'python-pymongo' }}"
7+
mongodb_pymongo_package: "{{ 'python3-pymongo' if ansible_facts['python'].version.major == 3 else 'python-pymongo' }}"
88
mongodb_pymongo_deps:
9-
- "{{ 'python3-dev' if ansible_python_interpreter is search('python3') | bool else 'python-dev' }}"
10-
- "{{ 'python3-pip' if ansible_python_interpreter is search('python3') | bool else 'python-pip' }}"
11-
mongodb_python_setuptools: "{{ 'python3-setuptools' if ansible_python_interpreter is search('python3') | bool else 'python-setuptools' }}"
12-
mongodb_pip_executable: "{{ 'pip3' if ansible_python_interpreter is search('python3') | bool else 'pip' }}"
13-
9+
- "{{ 'python3-dev' if ansible_facts['python'].version.major == 3 else 'python-dev' }}"
10+
- "{{ 'python3-pip' if ansible_facts['python'].version.major == 3 else 'python-pip' }}"
11+
mongodb_python_setuptools: "{{ 'python3-setuptools' if ansible_facts['python'].version.major == 3 else 'python-setuptools' }}"
12+
mongodb_pip_executable: "{{ 'pip3' if ansible_facts['python'].version.major == 3 else 'pip' }}"

0 commit comments

Comments
 (0)