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).
Watch video Ansible: Playbook to install MongoDB on three servers online without registration, duration hours minute second in high quality. This video was added by user CyberScribe.org 20 June 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 3,72 once and liked it 1 people.