Ansible: Playbook to install MongoDB on three servers

Опубликовано: 20 Июнь 2021
на канале: CyberScribe.org
3,723
18

In preparation for creating a three MongoDB node replica set, I'm installing the current version of MongoDB via a playbook.

First I'll update each managed node.
Then I'll import the MongoDB repository public key.
After that I'll add the MongoDB respository and install MongoDB.
Finally I'll set MongoDB to auto-start on each of the three nodes.


---
name: Download MongoDB repository and install MongoDB
hosts: mongo
become: true

tasks:
name: Upgrade all packages
yum:
name: '*'
state: latest

name: Add Mongo repository
yum_repository:
name: mongodb-org-4.4
description: MongoDB Repository Repo
baseurl: https://repo.mongodb.org/yum/redhat/$...
gpgkey: https://www.mongodb.org/static/pgp/se...

name: Install MongoDB
yum:
name: mongodb-org
state: present
update_cache: yes

name: Enable MongoDB to run on boot
service:
name: mongod
enabled: yes
state: started
...

TODOs:
Set up authentication on the servers.
Set the three nodes to become a MongoDB replica set (in future videos).


Смотрите видео Ansible: Playbook to install MongoDB on three servers онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь CyberScribe.org 20 Июнь 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 3,723 раз и оно понравилось 18 людям.