Introduce support for RedHat package installation
This provides initial support for installing the relevant MongoDB packages for a RedHat based OS. This currently only supports RHEL/CentOS 6 in order to keep the initial scope relatively constrained.
This commit is contained in:
parent
52b1f395ea
commit
b74bade421
24
.travis.yml
24
.travis.yml
|
@ -27,6 +27,30 @@ env:
|
|||
DISTRIBUTION=ubuntu-upstart
|
||||
DIST_VERSION=12.04
|
||||
MONGODB_VERSION=2.6
|
||||
- >
|
||||
DISTRIBUTION=centos
|
||||
DIST_VERSION=6
|
||||
MONGODB_VERSION=2.6
|
||||
- >
|
||||
DISTRIBUTION=centos
|
||||
DIST_VERSION=6
|
||||
MONGODB_VERSION=3.0
|
||||
- >
|
||||
DISTRIBUTION=centos
|
||||
DIST_VERSION=6
|
||||
MONGODB_VERSION=3.2
|
||||
- >
|
||||
DISTRIBUTION=centos
|
||||
DIST_VERSION=7
|
||||
MONGODB_VERSION=2.6
|
||||
- >
|
||||
DISTRIBUTION=centos
|
||||
DIST_VERSION=7
|
||||
MONGODB_VERSION=3.0
|
||||
- >
|
||||
DISTRIBUTION=centos
|
||||
DIST_VERSION=7
|
||||
MONGODB_VERSION=3.2
|
||||
# - >
|
||||
# distribution=ubuntu-upstart
|
||||
# version=12.04
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
---
|
||||
|
||||
- include_vars: "{{ansible_distribution}}.yml"
|
||||
|
||||
- name: Check if running on systemd
|
||||
command: cat /proc/1/cmdline
|
||||
register: systemd
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
|
||||
- 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'
|
||||
|
||||
- name: Install MongoDB package
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items:
|
||||
- "{{ mongodb_package }}"
|
||||
- numactl
|
||||
|
||||
- name: Install PyMongo package
|
||||
yum:
|
||||
name: python-pymongo
|
||||
state: latest
|
||||
when: not mongodb_pymongo_from_pip
|
||||
|
||||
- name: Install PIP
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
with_items:
|
||||
- python-devel
|
||||
- python-pip
|
||||
when: mongodb_pymongo_from_pip
|
||||
|
||||
- name: Install PyMongo from PIP
|
||||
pip:
|
||||
name: pymongo
|
||||
state: latest
|
||||
when: mongodb_pymongo_from_pip
|
|
@ -1,8 +1,13 @@
|
|||
---
|
||||
|
||||
- name: Include OS-specific variables
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- "{{ ansible_distribution }}.yml"
|
||||
- "{{ ansible_os_family }}.yml"
|
||||
|
||||
- name: Include installation on Debian-based OS
|
||||
include: install.deb.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
include: "install.{{ ansible_os_family | lower }}.yml"
|
||||
tags: [mongodb]
|
||||
|
||||
- name: Include configuration.yml
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
[mongodb-org-{{ mongodb_version }}]
|
||||
name=MongoDB {{ mongodb_version }} Repository
|
||||
baseurl={{ mongodb_repository[item] }}
|
||||
gpgcheck={{ mongodb_repository_gpgkey[item] is defined | ternary(1,0) }}
|
||||
{% if mongodb_repository_gpgkey[item] is defined %}
|
||||
gpgkey={{ mongodb_repository_gpgkey[item] }}
|
||||
{% endif %}
|
||||
enabled=1
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
|
||||
mongodb_repository:
|
||||
"2.6": "http://downloads-distro.mongodb.org/repo/redhat/os/$basearch/"
|
||||
"3.0": "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/$basearch/"
|
||||
"3.2": "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/$basearch/"
|
||||
|
||||
mongodb_repository_gpgkey:
|
||||
"3.2": "https://www.mongodb.org/static/pgp/server-3.2.asc"
|
Loading…
Reference in New Issue