How can DevOps improve your apps?
Introduction: The DevOps practices are very common nowadays in software organizations. Even though the concept is new to software the practice is not. Lots
of companies used to practice DevOps when software was not an industry at all. DevOps is not a funcationality rather it is an approach to solve daily software
development problems like packaging, configuring, testing, and deployment etc. As DevOps is a truly cross-functional mode of working there is no single
DevOps tool. It is rather a set if multiple tools.
Goals: The goals of DevOps span the entire delivery pipeline. They include:
Improved deployment frequency;
Lower failure rate of new releases;
Shortened lead time between fixes;
Delivery process becomes incredibly simple with DevOps.
Use Ansible to launch a MongoDB cluster in Atlas using API call: Ansible is the simplest way to automate apps and IT infrastructure. This tool is written on top
of python. So you need to have python installed and setup in the machine where you want to use Ansible. There are certain criterias you need to fulfill before
a cluster of MongoDB can be launched.
Prerequisites
MongoDB Atlas Account
IP Whitelist configured for API access
API Key
Group ID
Server to launch from
Ansible (sudo pip install ansible)
Configure Ansible
You can create an atlas account freely by following the steps in the website https://cloud.mongodb.com . Once you created an account successfully, log in to
the account. You need to whitelist the IP address you want to run Ansible from in the atlas account page. Go to your user account page and click public API
access(tab) https://cloud.mongodb.com/v2/XXXXXXXXX#account/publicApi. Click on add button to add new IP address to whitelist. Generate a new
API key by clicking generate button. Copy this API key value to a safe location. Go to the home page by clicking mongoDB Atlas link. Click on Settings link
and copy the group ID. Assuming you have python and pip installed already, now install Ansible by “sudo pip install ansible” command. Once done downlaod the
git repository https://github.com/jaydestro/atlas-ansible. Once clonned the repository edit the create-atlas.yml file like the below:
user: niraj.adhikari@accionlabs.com
apikey: YYYYYYYY-YYYY-hhhhh-00000
groupid: 5hhhhhhhhhhhhhhhhhhhhhh
all those above values will be diifferent for your case.
Edit the hosts file in the same directory like
hosts: 127.0.0.1
You can edit atlas.json also like below
{
“name” : “DataStore1”,
“numShards” : 1,
“mongoDBMajorVersion” : “3.4”,
“replicationFactor” : 3,
“providerSettings” : {
“providerName” : “AWS”,
“regionName” : “US_EAST_1”,
“instanceSizeName” : “M10”,
“diskIOPS” : 50,
“encryptEBSVolume” : false,
},
“diskSizeGB” : 10,
“backupEnabled” : false
}
The above edit will create a free MongoDB cluster in the US_EAST_1 AWS zone. If you need to create a cluster with chargeable server capacity you need to add
payment method in your atlas account first.
Now run the below command
ansible-playbook -v create-atlas.yml — diff
If everything goes well you will have a screen like below in your atlas account.

Enjoy.
USe Case Where we need to apply DevOps Practice: There are lot of other scenarios where you practice DevOps. You need to determine in which cases you need to
use DevOps practice. If you see the above process for MongoDB cluster it looks quite simple in terms of configurations and running ansible. The above use case
is ideal if we want to make a huge numbers of clusters.
