2019-05-17 11:57:53 +02: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
|
2019-05-27 15:00:59 -04:00
|
|
|
with_items: "{{ mongodb_major_version }}"
|
2019-05-28 15:55:35 -04:00
|
|
|
loop_control:
|
|
|
|
loop_var: version_item
|
2019-05-17 11:57:53 +02:00
|
|
|
when: mongodb_package == 'mongodb-org'
|
|
|
|
|
2019-05-27 15:00:59 -04:00
|
|
|
- name: Install MongoDB package
|
2019-05-17 11:57:53 +02:00
|
|
|
yum:
|
2019-05-27 15:00:59 -04:00
|
|
|
name: "{{ mongodb_package }}{% if (mongodb_version | length > 3) %}={{ mongodb_version }}{% endif %}"
|
2019-05-21 16:42:26 -04:00
|
|
|
state: "{{ mongodb_package_state }}"
|
2019-11-01 19:29:56 +09:00
|
|
|
lock_timeout: "{{ yum_lock_timeout }}"
|
2019-05-17 11:57:53 +02:00
|
|
|
|
2019-05-27 15:00:59 -04:00
|
|
|
- name: Install numactl package
|
|
|
|
yum:
|
|
|
|
name: numactl
|
|
|
|
state: present
|
2019-11-01 19:29:56 +09:00
|
|
|
lock_timeout: "{{ yum_lock_timeout }}"
|
2020-01-10 15:31:31 +01:00
|
|
|
when: mongodb_use_numa | bool
|
2019-05-27 15:00:59 -04:00
|
|
|
|
2019-05-17 11:57:53 +02:00
|
|
|
- name: Install PyMongo package
|
|
|
|
yum:
|
|
|
|
name: python-pymongo
|
2019-05-21 15:42:02 -04:00
|
|
|
state: present
|
2019-11-01 19:29:56 +09:00
|
|
|
lock_timeout: "{{ yum_lock_timeout }}"
|
2019-05-17 11:57:53 +02:00
|
|
|
when: not mongodb_pymongo_from_pip
|
|
|
|
|
|
|
|
- name: Install PIP
|
|
|
|
yum:
|
2019-05-17 12:10:09 +02:00
|
|
|
name:
|
2019-05-17 14:23:16 +02:00
|
|
|
- python-devel
|
|
|
|
- python-pip
|
2019-11-01 19:29:56 +09:00
|
|
|
lock_timeout: "{{ yum_lock_timeout }}"
|
2019-05-17 11:57:53 +02: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
|