|
9 | 9 | - mongodb_disable_transparent_hugepages | bool
|
10 | 10 | - ansible_service_mgr == "systemd"
|
11 | 11 |
|
| 12 | +- name: Install Required Dependency Packages |
| 13 | + apt: |
| 14 | + pkg: |
| 15 | + - software-properties-common |
| 16 | + - dirmngr |
| 17 | + - apt-transport-https |
| 18 | + - lsb-release |
| 19 | + - ca-certificates |
| 20 | + |
12 | 21 | - name: Add APT key
|
13 | 22 | apt_key:
|
14 |
| - keyserver: "{{ mongodb_apt_keyserver }}" |
15 |
| - id: "{{ mongodb_apt_key_id[mongodb_major_version] }}" |
| 23 | + url: "{{ mongodb_repository_gpgkey[mongodb_version] }}" |
16 | 24 | when: mongodb_package == 'mongodb-org'
|
17 | 25 |
|
18 | 26 | - name: Fail when used wrong mongodb_version variable with Debian Stretch
|
19 | 27 | fail:
|
20 |
| - msg: "mongodb_version variable should be '3.6' or '4.0' or '4.2' for Debian Stretch" |
| 28 | + msg: "mongodb_version variable should be '3.6' or '4.0' or '4.2' or '4.4' for Debian Stretch" |
21 | 29 | when:
|
22 | 30 | - mongodb_package == 'mongodb-org'
|
23 |
| - - (mongodb_major_version != '3.6' and mongodb_major_version != '4.0' and mongodb_major_version != '4.2') |
| 31 | + - (mongodb_major_version != '3.6' and mongodb_major_version != '4.0' and mongodb_major_version != '4.2' and mongodb_major_version != '4.4') |
24 | 32 | - ansible_distribution_release == 'stretch'
|
25 | 33 |
|
26 | 34 | - name: Fail when used wrong mongodb_version variable with Ubuntu 18.04
|
27 | 35 | fail:
|
28 |
| - msg: "mongodb_version variable should be '4.0' or '4.2', or else mongodb_package should be 'mongodb' for Ubuntu 18.04" |
| 36 | + msg: "mongodb_version variable should be '4.0' or '4.2' or '4.4', or else mongodb_package should be 'mongodb' for Ubuntu 18.04" |
29 | 37 | when:
|
30 | 38 | - mongodb_package == 'mongodb-org'
|
31 |
| - - (mongodb_major_version != '4.0' and mongodb_major_version != '4.2') |
| 39 | + - (mongodb_major_version != '4.0' and mongodb_major_version != '4.2' and mongodb_major_version != '4.4') |
32 | 40 | - ansible_distribution_release == "bionic"
|
33 | 41 |
|
34 | 42 | - name: Fail when used wrong mongodb_version variable
|
35 | 43 | fail:
|
36 |
| - msg: "mongodb_version variable should be '3.4', '3.6' or '4.0' or '4.2'" |
| 44 | + msg: "mongodb_version variable should be '3.4', '3.6' or '4.0' or '4.2' or '4.4'" |
37 | 45 | when: (mongodb_package == 'mongodb-org' and
|
38 | 46 | (mongodb_version is not defined
|
39 | 47 | or mongodb_repository[mongodb_major_version] is not defined))
|
|
57 | 65 | apt:
|
58 | 66 | name: numactl
|
59 | 67 | state: present
|
60 |
| - when: mongodb_use_numa | bool |
61 | 68 |
|
62 | 69 | - name: Add systemd configuration if present
|
63 | 70 | template:
|
64 | 71 | src: mongodb.service.j2
|
65 |
| - dest: "/lib/systemd/system/{{mongodb_daemon_name}}.service" |
| 72 | + dest: "/lib/systemd/system/{{ mongodb_daemon_name }}.service" |
66 | 73 | owner: root
|
67 | 74 | group: root
|
68 | 75 | mode: '0644'
|
|
74 | 81 |
|
75 | 82 | - name: Add symlink for systemd
|
76 | 83 | file:
|
77 |
| - src: "/lib/systemd/system/{{mongodb_daemon_name}}.service" |
78 |
| - dest: "/etc/systemd/system/multi-user.target.wants/{{mongodb_daemon_name}}.service" |
| 84 | + src: "/lib/systemd/system/{{ mongodb_daemon_name }}.service" |
| 85 | + dest: "/etc/systemd/system/multi-user.target.wants/{{ mongodb_daemon_name }}.service" |
79 | 86 | state: link
|
80 | 87 | when:
|
81 | 88 | - ansible_service_mgr == "systemd"
|
|
88 | 95 | name: python-pymongo
|
89 | 96 | when: not mongodb_pymongo_from_pip
|
90 | 97 |
|
91 |
| -- name: Install PIP |
| 98 | +- name: Install Python2 PIP |
92 | 99 | apt:
|
93 | 100 | pkg:
|
94 | 101 | - python-dev
|
95 | 102 | - python-pip
|
96 |
| - when: mongodb_pymongo_from_pip | bool |
| 103 | + when: mongodb_pymongo_from_pip | bool and ansible_distribution_release != 'focal' |
| 104 | + |
| 105 | +- name: Install Python3 PIP |
| 106 | + apt: |
| 107 | + pkg: |
| 108 | + - python3-dev |
| 109 | + - python3-pip |
| 110 | + when: mongodb_pymongo_from_pip | bool and ansible_distribution_release == 'focal' |
97 | 111 |
|
98 | 112 | - name: Install setuptools (required for ansible 2.7+)
|
99 | 113 | apt:
|
100 | 114 | pkg:
|
101 |
| - - python-setuptools |
| 115 | + - "{{ 'python3-setuptools' if (ansible_distribution_release == 'focal') else 'python-setuptools' }}" # different setuptools for python3 |
102 | 116 | when: mongodb_pymongo_from_pip | bool
|
103 | 117 |
|
104 | 118 | - name: Install PyMongo from PIP
|
105 | 119 | pip:
|
106 | 120 | name: pymongo
|
| 121 | + executable: "{{ 'pip3' if (ansible_distribution_release == 'focal') else 'pip' }}" # different pip for python3 |
107 | 122 | state: "{{ mongodb_pymongo_pip_version is defined | ternary('present', 'latest') }}"
|
108 | 123 | version: "{{ mongodb_pymongo_pip_version | default(omit) }}"
|
109 | 124 | when: mongodb_pymongo_from_pip | bool
|
0 commit comments