roles/mongodb: Add MongoDB deployment
The *mongodb* role installs MongoDB from the *mongodb.org* Yum repository and manages basic server configuration.
This commit is contained in:
1
roles/mongodb/defaults/main.yml
Normal file
1
roles/mongodb/defaults/main.yml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
mongodb_version: '4.0'
|
||||||
18
roles/mongodb/tasks/main.yml
Normal file
18
roles/mongodb/tasks/main.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
- name: ensure mongodb package repository is available
|
||||||
|
template:
|
||||||
|
src=mongodb.repo.j2
|
||||||
|
dest=/etc/yum.repos.d/mongodb.repo
|
||||||
|
mode=0644
|
||||||
|
tags:
|
||||||
|
- install
|
||||||
|
- name: ensure mongodb is installed
|
||||||
|
package:
|
||||||
|
name: mongodb-org-server
|
||||||
|
state: present
|
||||||
|
tags:
|
||||||
|
- install
|
||||||
|
|
||||||
|
- name: ensure mongodb server starts at boot
|
||||||
|
service:
|
||||||
|
name=mongod
|
||||||
|
enabled=yes
|
||||||
6
roles/mongodb/templates/mongodb.repo.j2
Normal file
6
roles/mongodb/templates/mongodb.repo.j2
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[mongodb-org-{{ mongodb_version }}]
|
||||||
|
name=MongoDB Repository
|
||||||
|
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/{{ mongodb_version }}/x86_64/
|
||||||
|
gpgcheck=1
|
||||||
|
enabled=1
|
||||||
|
gpgkey=https://www.mongodb.org/static/pgp/server-{{ mongodb_version }}.asc
|
||||||
Reference in New Issue
Block a user