Skip to content

Commit 7fc9162

Browse files
committed
Merge remote-tracking branch 'sportsru/python3_interpreter' into sergei/add_more_distros_gh_actions
2 parents 07c49c0 + ac0f404 commit 7fc9162

File tree

7 files changed

+40
-14
lines changed

7 files changed

+40
-14
lines changed

tasks/install.amazon.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,14 @@
2828

2929
- name: Install PyMongo package
3030
yum:
31-
name: python-pymongo
31+
name: "{{ mongodb_pymongo_package }}"
3232
state: present
3333
lock_timeout: "{{ yum_lock_timeout }}"
3434
when: not mongodb_pymongo_from_pip
3535

3636
- name: Install PIP
3737
yum:
38-
name:
39-
- python-devel
40-
- python-pip
38+
name: "{{ mongodb_pymongo_deps }}"
4139
lock_timeout: "{{ yum_lock_timeout }}"
4240
when: mongodb_pymongo_from_pip
4341

@@ -46,4 +44,5 @@
4644
name: pymongo
4745
state: "{{ mongodb_pymongo_pip_version is defined | ternary('present', 'latest') }}"
4846
version: "{{ mongodb_pymongo_pip_version | default(omit) }}"
47+
executable: "{{ mongodb_pip_executable }}"
4948
when: mongodb_pymongo_from_pip

tasks/install.debian.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,18 @@
106106

107107
- name: Install PyMongo package
108108
apt:
109-
name: "{{ 'python-pymongo' if ansible_facts['python'].version.major == 2 else 'python3-pymongo' }}"
109+
name: "{{ mongodb_pymongo_package }}"
110110
when: not mongodb_pymongo_from_pip
111111

112112
- name: Install PIP
113113
apt:
114-
pkg:
115-
- python-dev
116-
- python-pip
114+
pkg: "{{ mongodb_pymongo_deps }}"
117115
when: mongodb_pymongo_from_pip | bool
118116

119117
# TODO: check if it is still needed for Debian/Ubuntu
120118
- name: Install setuptools (required for ansible 2.7+)
121119
apt:
122-
pkg:
123-
- python-setuptools
120+
pkg: "{{ mongodb_python_setuptools }}"
124121
when: mongodb_pymongo_from_pip | bool
125122

126123
- name: Install PyMongo from PIP
@@ -129,4 +126,5 @@
129126
- pymongo
130127
state: "{{ mongodb_pymongo_pip_version is defined | ternary('present', 'latest') }}"
131128
version: "{{ mongodb_pymongo_pip_version | default(omit) }}"
129+
executable: "{{ mongodb_pip_executable }}"
132130
when: mongodb_pymongo_from_pip | bool

tasks/install.redhat.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,14 @@
3434

3535
- name: Install PyMongo package
3636
yum:
37-
name: python-pymongo
37+
name: "{{ mongodb_pymongo_package }}"
3838
state: present
3939
lock_timeout: "{{ yum_lock_timeout }}"
4040
when: not mongodb_pymongo_from_pip
4141

4242
- name: Install PIP
4343
yum:
44-
name:
45-
- python-devel
46-
- python-pip
44+
name: "{{ mongodb_pymongo_deps }}"
4745
lock_timeout: "{{ yum_lock_timeout }}"
4846
when: mongodb_pymongo_from_pip | bool
4947

@@ -52,4 +50,5 @@
5250
name: pymongo
5351
state: "{{ mongodb_pymongo_pip_version is defined | ternary('present', 'latest') }}"
5452
version: "{{ mongodb_pymongo_pip_version | default(omit) }}"
53+
executable: "{{ mongodb_pip_executable }}"
5554
when: mongodb_pymongo_from_pip | bool

vars/Amazon.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,10 @@ mongodb_repository_gpgkey:
1212
mongodb_pidfile_path: "{{ '/var/run/mongodb/mongod.pid' if ('mongodb-org' in mongodb_package) else '' }}"
1313

1414
yum_lock_timeout: 180
15+
16+
mongodb_pymongo_package: "{{ 'python3-pymongo' if ansible_python_interpreter is search('python3') | bool else 'python-pymongo' }}"
17+
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+

vars/Debian.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@ mongodb_repository:
33
"3.6": "deb http://repo.mongodb.org/apt/debian {{ ansible_distribution_release }}/mongodb-org/3.6 main"
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"
6+
7+
mongodb_pymongo_package: "{{ 'python3-pymongo' if ansible_python_interpreter is search('python3') | bool else 'python-pymongo' }}"
8+
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+

vars/RedHat.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,10 @@ mongodb_repository_gpgkey:
1212
mongodb_pidfile_path: "{{ '/var/run/mongodb/mongod.pid' if ('mongodb-org' in mongodb_package) else '' }}"
1313

1414
yum_lock_timeout: 180
15+
16+
mongodb_pymongo_package: "{{ 'python3-pymongo' if ansible_python_interpreter is search('python3') | bool else 'python-pymongo' }}"
17+
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+

vars/Ubuntu.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@ mongodb_repository:
33
"3.6": "deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/3.6 multiverse"
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"
6+
7+
mongodb_pymongo_package: "{{ 'python3-pymongo' if ansible_python_interpreter is search('python3') | bool else 'python-pymongo' }}"
8+
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+

0 commit comments

Comments
 (0)