File tree Expand file tree Collapse file tree 8 files changed +45
-15
lines changed Expand file tree Collapse file tree 8 files changed +45
-15
lines changed Original file line number Diff line number Diff line change 156
156
type: string
157
157
sample: "replica"
158
158
'''
159
- import ConfigParser
159
+ import sys
160
+ if sys .version_info >= (3 , 0 ):
161
+ import configparser
162
+ else :
163
+ import ConfigParser
160
164
import ssl as ssl_lib
161
165
import time
162
166
from datetime import datetime as dtdatetime
Original file line number Diff line number Diff line change 28
28
29
29
- name : Install PyMongo package
30
30
yum :
31
- name : python-pymongo
31
+ name : " {{ mongodb_pymongo_package }} "
32
32
state : present
33
33
lock_timeout : " {{ yum_lock_timeout }}"
34
34
when : not mongodb_pymongo_from_pip
35
35
36
36
- name : Install PIP
37
37
yum :
38
- name :
39
- - python-devel
40
- - python-pip
38
+ name : " {{ mongodb_pymongo_deps }}"
41
39
lock_timeout : " {{ yum_lock_timeout }}"
42
40
when : mongodb_pymongo_from_pip
43
41
46
44
name : pymongo
47
45
state : " {{ mongodb_pymongo_pip_version is defined | ternary('present', 'latest') }}"
48
46
version : " {{ mongodb_pymongo_pip_version | default(omit) }}"
47
+ executable : " {{ mongodb_pip_executable }}"
49
48
when : mongodb_pymongo_from_pip
Original file line number Diff line number Diff line change 85
85
86
86
- name : Install PyMongo package
87
87
apt :
88
- name : python-pymongo
88
+ name : " {{ mongodb_pymongo_package }} "
89
89
when : not mongodb_pymongo_from_pip
90
90
91
91
- name : Install PIP
92
92
apt :
93
- pkg :
94
- - python-dev
95
- - python-pip
93
+ pkg : " {{ mongodb_pymongo_deps }}"
96
94
when : mongodb_pymongo_from_pip | bool
97
95
98
96
- name : Install setuptools (required for ansible 2.7+)
99
97
apt :
100
- pkg :
101
- - python-setuptools
98
+ pkg : " {{ mongodb_python_setuptools }}"
102
99
when : mongodb_pymongo_from_pip | bool
103
100
104
101
- name : Install PyMongo from PIP
105
102
pip :
106
103
name : pymongo
107
104
state : " {{ mongodb_pymongo_pip_version is defined | ternary('present', 'latest') }}"
108
105
version : " {{ mongodb_pymongo_pip_version | default(omit) }}"
106
+ executable : " {{ mongodb_pip_executable }}"
109
107
when : mongodb_pymongo_from_pip | bool
Original file line number Diff line number Diff line change 34
34
35
35
- name : Install PyMongo package
36
36
yum :
37
- name : python-pymongo
37
+ name : " {{ mongodb_pymongo_package }} "
38
38
state : present
39
39
lock_timeout : " {{ yum_lock_timeout }}"
40
40
when : not mongodb_pymongo_from_pip
41
41
42
42
- name : Install PIP
43
43
yum :
44
- name :
45
- - python-devel
46
- - python-pip
44
+ name : " {{ mongodb_pymongo_deps }}"
47
45
lock_timeout : " {{ yum_lock_timeout }}"
48
46
when : mongodb_pymongo_from_pip | bool
49
47
52
50
name : pymongo
53
51
state : " {{ mongodb_pymongo_pip_version is defined | ternary('present', 'latest') }}"
54
52
version : " {{ mongodb_pymongo_pip_version | default(omit) }}"
53
+ executable : " {{ mongodb_pip_executable }}"
55
54
when : mongodb_pymongo_from_pip | bool
Original file line number Diff line number Diff line change @@ -13,3 +13,10 @@ mongodb_repository_gpgkey:
13
13
mongodb_pidfile_path : " {{ '/var/run/mongodb/mongod.pid' if ('mongodb-org' in mongodb_package) else '' }}"
14
14
15
15
yum_lock_timeout : 180
16
+
17
+ mongodb_pymongo_package : " {{ 'python3-pymongo' if ansible_python_interpreter is search('python3') | bool else 'python-pymongo' }}"
18
+ mongodb_pymongo_deps :
19
+ - " {{ 'python3-devel' if ansible_python_interpreter is search('python3') | bool else 'python-devel' }}"
20
+ - " {{ 'python3-pip' if ansible_python_interpreter is search('python3') | bool else 'python-pip' }}"
21
+ mongodb_pip_executable : " {{ 'pip3' if ansible_python_interpreter is search('python3') | bool else 'pip' }}"
22
+
Original file line number Diff line number Diff line change @@ -4,3 +4,11 @@ mongodb_repository:
4
4
" 3.6 " : " deb http://repo.mongodb.org/apt/debian {{ ansible_distribution_release }}/mongodb-org/3.6 main"
5
5
" 4.0 " : " deb http://repo.mongodb.org/apt/debian {{ ansible_distribution_release }}/mongodb-org/4.0 main"
6
6
" 4.2 " : " deb http://repo.mongodb.org/apt/debian {{ ansible_distribution_release }}/mongodb-org/4.2 main"
7
+
8
+ mongodb_pymongo_package : " {{ 'python3-pymongo' if ansible_python_interpreter is search('python3') | bool else 'python-pymongo' }}"
9
+ mongodb_pymongo_deps :
10
+ - " {{ 'python3-dev' if ansible_python_interpreter is search('python3') | bool else 'python-dev' }}"
11
+ - " {{ 'python3-pip' if ansible_python_interpreter is search('python3') | bool else 'python-pip' }}"
12
+ mongodb_python_setuptools : " {{ 'python3-setuptools' if ansible_python_interpreter is search('python3') | bool else 'python-setuptools' }}"
13
+ mongodb_pip_executable : " {{ 'pip3' if ansible_python_interpreter is search('python3') | bool else 'pip' }}"
14
+
Original file line number Diff line number Diff line change @@ -14,3 +14,10 @@ mongodb_repository_gpgkey:
14
14
mongodb_pidfile_path : " {{ '/var/run/mongodb/mongod.pid' if ('mongodb-org' in mongodb_package) else '' }}"
15
15
16
16
yum_lock_timeout : 180
17
+
18
+ mongodb_pymongo_package : " {{ 'python3-pymongo' if ansible_python_interpreter is search('python3') | bool else 'python-pymongo' }}"
19
+ mongodb_pymongo_deps :
20
+ - " {{ 'python3-devel' if ansible_python_interpreter is search('python3') | bool else 'python-devel' }}"
21
+ - " {{ 'python3-pip' if ansible_python_interpreter is search('python3') | bool else 'python-pip' }}"
22
+ mongodb_pip_executable : " {{ 'pip3' if ansible_python_interpreter is search('python3') | bool else 'pip' }}"
23
+
Original file line number Diff line number Diff line change @@ -4,3 +4,11 @@ mongodb_repository:
4
4
" 3.6 " : " deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/3.6 multiverse"
5
5
" 4.0 " : " deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/4.0 multiverse"
6
6
" 4.2 " : " deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/4.2 multiverse"
7
+
8
+ mongodb_pymongo_package : " {{ 'python3-pymongo' if ansible_python_interpreter is search('python3') | bool else 'python-pymongo' }}"
9
+ mongodb_pymongo_deps :
10
+ - " {{ 'python3-dev' if ansible_python_interpreter is search('python3') | bool else 'python-dev' }}"
11
+ - " {{ 'python3-pip' if ansible_python_interpreter is search('python3') | bool else 'python-pip' }}"
12
+ mongodb_python_setuptools : " {{ 'python3-setuptools' if ansible_python_interpreter is search('python3') | bool else 'python-setuptools' }}"
13
+ mongodb_pip_executable : " {{ 'pip3' if ansible_python_interpreter is search('python3') | bool else 'pip' }}"
14
+
You can’t perform that action at this time.
0 commit comments