Skip to content

Commit 873fd19

Browse files
authored
Merge pull request #249 from UnderGreen/sergei/mongodb_44
Add support of MongoDB 4.4
2 parents 1f2f47e + 2dd49b5 commit 873fd19

File tree

15 files changed

+50
-36
lines changed

15 files changed

+50
-36
lines changed

.github/workflows/amazonlinux2.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
molecule_distro:
1717
- amazonlinux2
1818
mongodb_version:
19+
- '4.4'
1920
- '4.2'
2021
- '4.0'
2122
- '3.6'

.github/workflows/centos.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
- centos7
1818
- centos8
1919
mongodb_version:
20+
- '4.4'
2021
- '4.2'
2122
- '4.0'
2223
- '3.6'

.github/workflows/debian.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
- debian9
1818
- debian10
1919
mongodb_version:
20+
- '4.4'
2021
- '4.2'
2122
- '4.0'
2223
- '3.6'

.github/workflows/ubuntu.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
- '4.2'
2121
- '4.0'
2222
- '3.6'
23+
include:
24+
- molecule_distro: ubuntu2004
25+
mongodb_version: '4.4'
2326
env:
2427
MONGODB_VERSION: ${{ matrix.mongodb_version }}
2528
MOLECULE_DISTRO: ${{ matrix.molecule_distro }}

README.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
1-
# Ansible role for MongoDB
2-
![Centos](https://github.com/UnderGreen/ansible-role-mongodb/actions/workflows/centos.yml/badge.svg) ![Debian](https://github.com/UnderGreen/ansible-role-mongodb/actions/workflows/debian.yml/badge.svg)
1+
# Ansible role for MongoDB
2+
![Centos](https://github.com/UnderGreen/ansible-role-mongodb/actions/workflows/centos.yml/badge.svg) ![Debian](https://github.com/UnderGreen/ansible-role-mongodb/actions/workflows/debian.yml/badge.svg) ![Ubuntu](https://github.com/UnderGreen/ansible-role-mongodb/actions/workflows/ubuntu.yml/badge.svg) ![Amazon Linux 2](https://github.com/UnderGreen/ansible-role-mongodb/actions/workflows/amazonlinux2.yml/badge.svg)
33

4-
Ansible role which manages [MongoDB](http://www.mongodb.org/).
4+
Ansible role to install and manage [MongoDB](http://www.mongodb.org/).
55

6-
- Install and configure the MongoDB;
6+
- Install and configure the MongoDB
77
- Configure mongodb users
8+
- Configure authentication
89
- Configure replication
9-
- Provide handlers for restart and reload;
1010
- Setup MMS automation agent;
1111

1212
MongoDB support matrix:
1313

14-
| Distribution | < MongoDB 3.4 | MongoDB 3.6 | MongoDB 4.0 | MongoDB 4.2 |
15-
| -------------- | :-----------: | :----------------: | :----------------: | :----------------: |
16-
| Ubuntu 16.04 | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
17-
| Ubuntu 18.04 | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
18-
| Debian 9.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
19-
| Debian 10.x | :no_entry: | :x: | :x: | :white_check_mark: |
20-
| RHEL 7.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
21-
| RHEL 8.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
22-
| Amazon Linux 2 | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
23-
24-
- :white_check_mark: - fully tested, should works fine
25-
- :interrobang: - maybe works, not tested
14+
| Distribution | < MongoDB 3.4 | MongoDB 3.6 | MongoDB 4.0 | MongoDB 4.2 | MongoDB 4.4 |
15+
| -------------- | :-----------: | :----------------: | :----------------: | :----------------: | :----------------: |
16+
| Ubuntu 16.04 | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: |
17+
| Ubuntu 18.04 | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: |
18+
| Ubuntu 20.04 | :no_entry: | :x: | :x: | :x: | :white_check_mark: |
19+
| Debian 9.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
20+
| Debian 10.x | :no_entry: | :x: | :x: | :white_check_mark: | :white_check_mark: |
21+
| RHEL 7.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
22+
| RHEL 8.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
23+
| Amazon Linux 2 | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
24+
25+
- :white_check_mark: - fully tested
2626
- :x: - don't have official support
2727
- :no_entry: - MongoDB has reached EOL
2828

2929
#### Variables
3030

3131
```yaml
32-
# You can use this variable to control installation source of MongoDB
33-
# 'mongodb' will be installed from Debian/Ubuntu repos
34-
# 'mongodb-org' will be installed from MongoDB official repos
32+
# This variable is used to set source of MongoDB installation.
33+
# 'mongodb' - version provided by Debian-based distributions from their official package repositories.
34+
# 'mongodb-org' - version provided by MongoDB package repository.
35+
# 'mongodb' is not included in th role test matrix and working of it is not guarantied.
3536
mongodb_package: mongodb-org
3637

37-
# You can control installed version via this param.
38-
# Should be '3.6', '4.0' or '4.2'. This role doesn't support MongoDB < 3.6.
39-
# I will recommend you to use latest version of MongoDB.
40-
mongodb_version: "4.2"
38+
# `mongodb_version` variable sets version of MongoDB.
39+
# Should be '3.6', '4.0', '4.2' or '4.4'. This role doesn't support MongoDB < 3.6.
40+
# I would recommend you to use the latest version of MongoDB.
41+
mongodb_version: "4.4"
4142

4243
mongodb_pymongo_from_pip: true # Install latest PyMongo via PIP or package manager
4344
mongodb_pymongo_pip_version: 3.6.1 # Choose PyMong version to install from pip. If not set use latest

defaults/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
mongodb_package: mongodb-org
44
mongodb_package_state: present
5-
mongodb_version: "4.2"
5+
mongodb_version: "4.4"
66
mongodb_apt_keyserver: keyserver.ubuntu.com
77
mongodb_apt_key_id:
88
"3.6": "2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5"
99
"4.0": "9DA31620334BD75D9DCB49F368818C72E52529D4"
1010
"4.2": "E162F504A20CDF15827F718D4B7C549A058F8B6B"
11+
"4.4": "20691eec35216c63caf66ce1656408e390cfb1f5"
1112

1213
mongodb_pymongo_from_pip: true # Install latest PyMongo via PIP or package manager
1314
mongodb_pymongo_pip_version: 3.11.3

molecule/cluster/molecule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ provisioner:
4646
converge: ${MOLECULE_PLAYBOOK:-../default/converge.yml}
4747
prepare: ${MOLECULE_PLAYBOOK:-../default/prepare.yml}
4848
env:
49-
MONGODB_VERSION: ${MONGODB_VERSION:-4.2}
49+
MONGODB_VERSION: ${MONGODB_VERSION:-4.4}
5050
MONGODB_PACKAGE: ${MONGODB_PACKAGE:-mongodb-org}
5151
AUTH_STATE: ${AUTH_STATE:-disabled}
5252
REPLICASET: ${REPLICASET:-testrs}

molecule/default/molecule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ provisioner:
2828
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
2929
prepare: ${MOLECULE_PLAYBOOK:-prepare.yml}
3030
env:
31-
MONGODB_VERSION: ${MONGODB_VERSION:-4.2}
31+
MONGODB_VERSION: ${MONGODB_VERSION:-4.4}
3232
MONGODB_PACKAGE: ${MONGODB_PACKAGE:-mongodb-org}
3333
AUTH_STATE: ${AUTH_STATE:-disabled}
3434
inventory:

molecule/default/prepare.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
remote_user: root
44
become: yes
55
tasks:
6-
- name: Install prerequisite packages for molecule testing for Debian/Ubuntu >= 18
6+
- name: Install prerequisite packages for molecule testing on Debian or Ubuntu >= 18
77
apt:
88
update_cache: true
99
name:

tasks/install.debian.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
- name: Fail when used wrong mongodb_version variable
1919
fail:
20-
msg: "mongodb_version variable should be '3.6' or '4.0' or '4.2'"
20+
msg: "mongodb_version variable should be '3.6' or '4.0', '4.2' or '4.4'"
2121
when: (mongodb_package == 'mongodb-org' and
2222
(mongodb_version is not defined
2323
or mongodb_repository[mongodb_major_version] is not defined))
@@ -38,18 +38,17 @@
3838
update_cache: true
3939

4040
- name: Check if NUMA is available on host
41-
shell: "set -o pipefail && find /proc -name numa_maps | wc -l"
42-
args:
43-
executable: /bin/bash
44-
register: numa_number_lines
41+
command: "ls -1 /proc/1/numa_maps"
42+
register: numa_available
43+
ignore_errors: true
4544
changed_when: false
4645
check_mode: no
4746
when: mongodb_use_numa | bool
4847

4948
- name: Don't use NUMA if it is unavailable on host
5049
set_fact:
5150
mongodb_use_numa: false
52-
when: (mongodb_use_numa | bool and numa_number_lines.stdout | int == 0)
51+
when: (mongodb_use_numa | bool and numa_available.rc != 0)
5352

5453
- name: Install numactl package
5554
apt:
@@ -81,7 +80,8 @@
8180
notify:
8281
- reload systemd
8382

84-
- name: Forcefully set mongodb_pymongo_from_pip to true on Debian 10
83+
# Workaround for the idempotence issue on Debian 10 with pip module
84+
- name: Forcefully set mongodb_pymongo_from_pip to false on Debian 10
8585
set_fact:
8686
mongodb_pymongo_from_pip: false
8787
when:

tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
when: mongodb_replication_replset | length > 0
4444
tags: [mongodb]
4545

46-
- name: Check where admin user already exists
46+
- name: Check whether admin user is already exist
4747
command: >
4848
mongo --quiet {{ '--ssl --host ' + mongodb_net_ssl_host if mongodb_net_ssl_mode == 'requireSSL' else '' }} -u {{ mongodb_user_admin_name }} \
4949
-p {{ mongodb_user_admin_password }} --port {{ mongodb_net_port }} --eval 'db.version()' admin

vars/Amazon.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---
22
mongodb_repository:
3+
"4.4": "https://repo.mongodb.org/yum/amazon/2/mongodb-org/4.4/x86_64/"
34
"4.2": "https://repo.mongodb.org/yum/amazon/2/mongodb-org/4.2/x86_64/"
45
"4.0": "https://repo.mongodb.org/yum/amazon/2/mongodb-org/4.0/x86_64/"
56
"3.6": "https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.6/x86_64/"
67

78
mongodb_repository_gpgkey:
9+
"4.4": "https://www.mongodb.org/static/pgp/server-4.4.asc"
810
"4.2": "https://www.mongodb.org/static/pgp/server-4.2.asc"
911
"4.0": "https://www.mongodb.org/static/pgp/server-4.0.asc"
1012
"3.6": "https://www.mongodb.org/static/pgp/server-3.6.asc"

vars/Debian.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ 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+
"4.4": "deb http://repo.mongodb.org/apt/debian {{ ansible_distribution_release }}/mongodb-org/4.4 main"
67

78
mongodb_pymongo_package: "{{ 'python3-pymongo' if ansible_facts['python'].version.major == 3 else 'python-pymongo' }}"
89
mongodb_pymongo_deps:

vars/RedHat.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ mongodb_repository:
33
"3.6": "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/$basearch/"
44
"4.0": "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/$basearch/"
55
"4.2": "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/$basearch/"
6+
"4.4": "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/$basearch/"
67

78
mongodb_repository_gpgkey:
89
"3.6": "https://www.mongodb.org/static/pgp/server-3.6.asc"
910
"4.0": "https://www.mongodb.org/static/pgp/server-4.0.asc"
1011
"4.2": "https://www.mongodb.org/static/pgp/server-4.2.asc"
12+
"4.4": "https://www.mongodb.org/static/pgp/server-4.4.asc"
1113

1214
mongodb_pidfile_path: "{{ '/var/run/mongodb/mongod.pid' if ('mongodb-org' in mongodb_package) else '' }}"
1315

vars/Ubuntu.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ 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+
"4.4": "deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/4.4 multiverse"
67

78
mongodb_pymongo_package: "{{ 'python3-pymongo' if ansible_facts['python'].version.major == 3 else 'python-pymongo' }}"
89
mongodb_pymongo_deps:

0 commit comments

Comments
 (0)