2016-04-27 04:45:25 +00:00
|
|
|
---
|
|
|
|
|
2017-09-14 06:57:16 +00:00
|
|
|
- name: Establish some role-related facts
|
|
|
|
set_fact:
|
|
|
|
mongodb_major_version: "{{ mongodb_version[0:3] }}"
|
|
|
|
|
2017-09-18 10:39:07 +00:00
|
|
|
- name: Install EPEL release repository
|
|
|
|
package:
|
|
|
|
name: epel-release
|
|
|
|
state: present
|
|
|
|
|
2016-04-27 04:45:25 +00:00
|
|
|
- name: Add YUM repository
|
|
|
|
template:
|
|
|
|
src: mongodb.repo.j2
|
|
|
|
dest: /etc/yum.repos.d/mongodb.repo
|
|
|
|
mode: 0644
|
2019-05-27 19:00:59 +00:00
|
|
|
with_items: "{{ mongodb_major_version }}"
|
2019-05-28 17:39:54 +00:00
|
|
|
loop_control:
|
|
|
|
loop_var: version_item
|
2016-04-27 04:45:25 +00:00
|
|
|
when: mongodb_package == 'mongodb-org'
|
|
|
|
|
|
|
|
- name: Install MongoDB package
|
|
|
|
yum:
|
2019-05-27 19:00:59 +00:00
|
|
|
name: "{{ mongodb_package }}{% if (mongodb_version | length > 3) %}={{ mongodb_version }}{% endif %}"
|
2019-05-21 20:42:26 +00:00
|
|
|
state: "{{ mongodb_package_state }}"
|
2016-04-27 04:45:25 +00:00
|
|
|
|
2019-05-27 19:00:59 +00:00
|
|
|
- name: Install numactl package
|
|
|
|
yum:
|
|
|
|
name: numactl
|
|
|
|
state: present
|
|
|
|
|
2016-04-27 04:45:25 +00:00
|
|
|
- name: Install PyMongo package
|
|
|
|
yum:
|
|
|
|
name: python-pymongo
|
2019-05-21 19:42:02 +00:00
|
|
|
state: present
|
2016-04-27 04:45:25 +00:00
|
|
|
when: not mongodb_pymongo_from_pip
|
|
|
|
|
|
|
|
- name: Install PIP
|
|
|
|
yum:
|
2019-05-26 02:52:10 +00:00
|
|
|
name:
|
|
|
|
- python-devel
|
|
|
|
- python-pip
|
2019-05-28 17:39:54 +00:00
|
|
|
when: mongodb_pymongo_from_pip | bool
|
2016-04-27 04:45:25 +00:00
|
|
|
|
|
|
|
- name: Install PyMongo from PIP
|
|
|
|
pip:
|
|
|
|
name: pymongo
|
2018-06-27 09:57:28 +00:00
|
|
|
state: "{{ mongodb_pymongo_pip_version is defined | ternary('present', 'latest') }}"
|
|
|
|
version: "{{ mongodb_pymongo_pip_version | default(omit) }}"
|
2019-05-28 17:39:54 +00:00
|
|
|
when: mongodb_pymongo_from_pip | bool
|