2019-05-17 09:57:53 +00:00
|
|
|
---
|
|
|
|
- name: Establish some role-related facts
|
|
|
|
set_fact:
|
|
|
|
mongodb_major_version: "{{ mongodb_version[0:3] }}"
|
|
|
|
|
|
|
|
- name: Add YUM repository
|
|
|
|
template:
|
|
|
|
src: mongodb.repo.j2
|
|
|
|
dest: /etc/yum.repos.d/mongodb.repo
|
|
|
|
mode: 0644
|
|
|
|
with_items: "{{ mongodb_version[0:3] }}"
|
|
|
|
when: mongodb_package == 'mongodb-org'
|
|
|
|
|
2019-05-21 20:42:26 +00:00
|
|
|
- name: Install MongoDB and numactl packages
|
2019-05-17 09:57:53 +00:00
|
|
|
yum:
|
2019-05-21 20:42:26 +00:00
|
|
|
name:
|
|
|
|
- "{{ mongodb_package }}"
|
|
|
|
- numactl
|
|
|
|
state: "{{ mongodb_package_state }}"
|
2019-05-17 09:57:53 +00:00
|
|
|
|
|
|
|
- name: Install PyMongo package
|
|
|
|
yum:
|
|
|
|
name: python-pymongo
|
2019-05-21 19:42:02 +00:00
|
|
|
state: present
|
2019-05-17 09:57:53 +00:00
|
|
|
when: not mongodb_pymongo_from_pip
|
|
|
|
|
|
|
|
- name: Install PIP
|
|
|
|
yum:
|
2019-05-17 10:10:09 +00:00
|
|
|
name:
|
2019-05-17 12:23:16 +00:00
|
|
|
- python-devel
|
|
|
|
- python-pip
|
2019-05-17 09:57:53 +00:00
|
|
|
when: mongodb_pymongo_from_pip
|
|
|
|
|
|
|
|
- name: Install PyMongo from PIP
|
|
|
|
pip:
|
|
|
|
name: pymongo
|
|
|
|
state: "{{ mongodb_pymongo_pip_version is defined | ternary('present', 'latest') }}"
|
|
|
|
version: "{{ mongodb_pymongo_pip_version | default(omit) }}"
|
|
|
|
when: mongodb_pymongo_from_pip
|