Add suport for MongoDB v4.0

This commit is contained in:
Florian Mauduit 2018-10-03 12:41:39 +02:00
parent 0dd9e517c3
commit 659299e01f
7 changed files with 24 additions and 18 deletions

View File

@ -10,15 +10,15 @@ Ansible role which manages [MongoDB](http://www.mongodb.org/).
MongoDB support matrix: MongoDB support matrix:
| Distribution | < MongoDB 3.0 | MongoDB 3.2 | MongoDB 3.4 | MongoDB 3.6 | | Distribution | < MongoDB 3.0 | MongoDB 3.2 | MongoDB 3.4 | MongoDB 3.6 | MongoDB 4.0 |
| ------------ |:-------------:|:-----------:|:-----------:|:-----------:| | ------------ |:-------------:|:-----------:|:-----------:|:-----------:|
| Ubuntu 14.04 | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| | Ubuntu 14.04 | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:|
| Ubuntu 16.04 | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| | Ubuntu 16.04 | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:|
| Ubuntu 18.04 | :no_entry: | :x:| :x:| :white_check_mark:| | Ubuntu 18.04 | :no_entry: | :x:| :x:| :white_check_mark:| :white_check_mark:|
| Debian 8.x | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| | Debian 8.x | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:|
| Debian 9.x | :no_entry: | :white_check_mark:| :x:| :white_check_mark:| | Debian 9.x | :no_entry: | :white_check_mark:| :x:| :white_check_mark:| :white_check_mark:|
| RHEL 6.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark:| | RHEL 6.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark:| :white_check_mark:|
| RHEL 7.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark:| | RHEL 7.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark:| :white_check_mark:|
- :white_check_mark: - fully tested, should works fine - :white_check_mark: - fully tested, should works fine
- :interrobang: - maybe works, not tested - :interrobang: - maybe works, not tested

View File

@ -7,9 +7,10 @@ mongodb_apt_key_id:
"3.2": "EA312927" "3.2": "EA312927"
"3.4": "0C49F3730359A14518585931BC711F9BA15703C6" "3.4": "0C49F3730359A14518585931BC711F9BA15703C6"
"3.6": "2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5" "3.6": "2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5"
"4.0": "9DA31620334BD75D9DCB49F368818C72E52529D4"
mongodb_pymongo_from_pip: true # Install latest PyMongo via PIP or package manager mongodb_pymongo_from_pip: true # Install latest PyMongo via PIP or package manager
mongodb_pymongo_pip_version: 3.6.1 mongodb_pymongo_pip_version: 3.7.1
mongodb_user_update_password: "on_create" # MongoDB user password update default policy mongodb_user_update_password: "on_create" # MongoDB user password update default policy
mongodb_manage_service: true mongodb_manage_service: true

View File

@ -9,7 +9,7 @@
- name: Establish some role-related facts - name: Establish some role-related facts
set_fact: set_fact:
mongodb_is_systemd: "{{ sbin_init.stat.islnk is defined and sbin_init.stat.islnk }}" mongodb_is_systemd: "{{ sbin_init.stat.islnk is defined and sbin_init.stat.islnk }}"
mongodb_major_version: "{{ mongodb_version[0:3] }}" mongodb_major_version: "{{ mongodb_version[0:4] }}"
- name: Add APT key - name: Add APT key
apt_key: apt_key:
@ -19,21 +19,22 @@
- name: Fail when used wrong mongodb_version variable with Debian Stretch - name: Fail when used wrong mongodb_version variable with Debian Stretch
fail: fail:
msg: "mongodb_version variable should be '3.2' or '3.6' for Debian Stretch" msg: "mongodb_version variable should be '3.2' or '3.6' or '4.0' for Debian Stretch"
when: (mongodb_package == 'mongodb-org' and when: (mongodb_package == 'mongodb-org' and
(mongodb_version is not defined (mongodb_version is not defined
or mongodb_repository[mongodb_major_version] is not defined or mongodb_repository[mongodb_major_version] is not defined
or mongodb_version != '3.6') and ansible_distribution_release == 'stretch') or (mongodb_version != '3.6' and mongodb_version != '4.0'))
and (ansible_distribution_release == 'stretch' and ansible_distribution_release == 'jessie'))
- name: Fail when used wrong mongodb_version variable with Ubuntu 18.04 - name: Fail when used wrong mongodb_version variable with Ubuntu 18.04
fail: fail:
msg: "mongodb_version variable should be '3.6' and mongodb_package should be 'mongodb' for Ubuntu 18.04" msg: "mongodb_version variable should be '3.6' or '4.0' and mongodb_package should be 'mongodb' for Ubuntu 18.04"
when: ((mongodb_package == 'mongodb-org' or mongodb_version != '3.6') when: ((mongodb_package == 'mongodb-org' or (mongodb_version != '3.6' and mongodb_version != '4.0'))
and ansible_distribution_release == "bionic") and ansible_distribution_release == "bionic")
- name: Fail when used wrong mongodb_version variable - name: Fail when used wrong mongodb_version variable
fail: fail:
msg: "mongodb_version variable should be '3.2', '3.4' or '3.6'" msg: "mongodb_version variable should be '3.2', '3.4', '3.6' or '4.0'"
when: (mongodb_package == 'mongodb-org' and when: (mongodb_package == 'mongodb-org' and
(mongodb_version is not defined (mongodb_version is not defined
or mongodb_repository[mongodb_major_version] is not defined)) or mongodb_repository[mongodb_major_version] is not defined))

View File

@ -2,7 +2,7 @@
- name: Establish some role-related facts - name: Establish some role-related facts
set_fact: set_fact:
mongodb_major_version: "{{ mongodb_version[0:3] }}" mongodb_major_version: "{{ mongodb_version[0:4] }}"
- name: Install EPEL release repository - name: Install EPEL release repository
package: package:
@ -14,7 +14,7 @@
src: mongodb.repo.j2 src: mongodb.repo.j2
dest: /etc/yum.repos.d/mongodb.repo dest: /etc/yum.repos.d/mongodb.repo
mode: 0644 mode: 0644
with_items: "{{ mongodb_version[0:3] }}" with_items: "{{ mongodb_version[0:4] }}"
when: mongodb_package == 'mongodb-org' when: mongodb_package == 'mongodb-org'
- name: Install MongoDB package - name: Install MongoDB package

View File

@ -3,3 +3,4 @@ mongodb_repository:
"3.2": "deb http://repo.mongodb.org/apt/debian {{ ansible_distribution_release }}/mongodb-org/3.2 main" "3.2": "deb http://repo.mongodb.org/apt/debian {{ ansible_distribution_release }}/mongodb-org/3.2 main"
"3.4": "deb http://repo.mongodb.org/apt/debian {{ ansible_distribution_release }}/mongodb-org/3.4 main" "3.4": "deb http://repo.mongodb.org/apt/debian {{ ansible_distribution_release }}/mongodb-org/3.4 main"
"3.6": "deb http://repo.mongodb.org/apt/debian {{ ansible_distribution_release }}/mongodb-org/3.6 main" "3.6": "deb http://repo.mongodb.org/apt/debian {{ ansible_distribution_release }}/mongodb-org/3.6 main"
"4.0": "deb http://repo.mongodb.org/apt/debian {{ ansible_distribution_release }}/mongodb-org/4.0 main"

View File

@ -4,10 +4,12 @@ mongodb_repository:
"3.2": "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/$basearch/" "3.2": "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/$basearch/"
"3.4": "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/$basearch/" "3.4": "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/$basearch/"
"3.6": "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/$basearch/" "3.6": "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/$basearch/"
"4.0": "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/$basearch/"
mongodb_repository_gpgkey: mongodb_repository_gpgkey:
"3.2": "https://www.mongodb.org/static/pgp/server-3.2.asc" "3.2": "https://www.mongodb.org/static/pgp/server-3.2.asc"
"3.4": "https://www.mongodb.org/static/pgp/server-3.4.asc" "3.4": "https://www.mongodb.org/static/pgp/server-3.4.asc"
"3.6": "https://www.mongodb.org/static/pgp/server-3.6.asc" "3.6": "https://www.mongodb.org/static/pgp/server-3.6.asc"
"4.0": "https://www.mongodb.org/static/pgp/server-4.0.asc"
mongodb_pidfile_path: "{{ '/var/run/mongodb/mongod.pid' if ('mongodb-org' in mongodb_package) else '' }}" mongodb_pidfile_path: "{{ '/var/run/mongodb/mongod.pid' if ('mongodb-org' in mongodb_package) else '' }}"

View File

@ -3,3 +3,4 @@ mongodb_repository:
"3.2": "deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/3.2 multiverse" "3.2": "deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/3.2 multiverse"
"3.4": "deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/3.4 multiverse" "3.4": "deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/3.4 multiverse"
"3.6": "deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/3.6 multiverse" "3.6": "deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/3.6 multiverse"
"4.0": "deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/4.0 multiverse"