In this ansible role we can Patch and reboot the Mongo Cluster for new kernel update.
- Centos:7
 
The below plugin is needed to run this ansible role.
- community.mongodb.mongodb_shell
 
ansible-galaxy collection install community.mongodb
An example inventory could be like this:-
[mongo_primary]
3.144.137.10
[mongo_secondary]
18.221.249.129
13.59.139.133
[mongo:children]
mongo_primary
mongo_secondary
[mongo:vars]
ansible_user=ec2-user
---
- name: This is patching mongo role
  hosts: all 
  become: yes
  roles: 
    - role: mongo_patching
Secrets.yml is required to run this ansible role. To Create
 ansible-vault encrypt_string 'USERNAME' --name 'login_user' >> secrets.yml
 ansible-vault encrypt_string 'PASSWORD' --name 'login_password' >> secrets.yml
To execute role
ansible-playbook -e "@secrets.yml" -i hosts sites.yml --ask-vault-pass - Focus on some role Enhancement
 - Patch mongo cluster for ubuntu distribution.
 
