{"id":15530794,"url":"https://github.com/mrlynn/ansible-opsmanager-demo","last_synced_at":"2025-08-30T20:07:21.476Z","repository":{"id":27529167,"uuid":"114272972","full_name":"mrlynn/ansible-opsmanager-demo","owner":"mrlynn","description":"Deploy a MongoDB Opsmanager Instance and a simple Replica Set for Demonstration Purposes","archived":false,"fork":false,"pushed_at":"2025-08-26T22:06:58.000Z","size":568,"stargazers_count":4,"open_issues_count":21,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-27T06:58:10.409Z","etag":null,"topics":["ansible","backup","deployment","management","mongodb","monitoring","opsmanager"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrlynn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-12-14T16:28:38.000Z","updated_at":"2023-02-25T06:42:12.000Z","dependencies_parsed_at":"2023-12-26T23:19:41.283Z","dependency_job_id":"67683bd3-5d15-4eda-8499-6db77c252549","html_url":"https://github.com/mrlynn/ansible-opsmanager-demo","commit_stats":{"total_commits":101,"total_committers":2,"mean_commits":50.5,"dds":"0.14851485148514854","last_synced_commit":"89b299a853a57328c5da2cd8f196c08df0796632"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mrlynn/ansible-opsmanager-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrlynn%2Fansible-opsmanager-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrlynn%2Fansible-opsmanager-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrlynn%2Fansible-opsmanager-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrlynn%2Fansible-opsmanager-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrlynn","download_url":"https://codeload.github.com/mrlynn/ansible-opsmanager-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrlynn%2Fansible-opsmanager-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272900157,"owners_count":25012033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","backup","deployment","management","mongodb","monitoring","opsmanager"],"created_at":"2024-10-02T11:24:03.830Z","updated_at":"2025-08-30T20:07:21.454Z","avatar_url":"https://github.com/mrlynn.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Synopsis\n\nThis directory contains details and instructions to help you get set up to deploy a MongoDB Opsmanager instance along with a MongoDB replica set.\n\n## Overview\nThis repository contains playbooks and scripts designed to automate the process of deploying, and configuring MongoDB Opsmanager for the purpose of demonstrating how you will improve the efficiency managing your MongoDB implementation using Opsmanager.\n\nOpsmanager was designed to help manage MongoDB across 4 key categories of activities:\n\n1. Monitoring\n2. Optimization\n3. Automation\n4. Backup\n\n## Prerequisites\n\nIn order to begin showing the power and flexibility of Opsmanager, we first need to set up our environment.  We're using [Ansible](http://ansible.com) to automate deployment and configuration of our instances.  We're also relying on [Amazon EC2](https://aws.amazon.com/ec2) for hosting of our instances.  While you may deploy local instances on your desktop/laptop, instances in docker, or in VMWare, we'll focus on EC2 for the purpose of this demonstration.\n\n1. Ansible\n\n - On Mac OS - simply type:\n\n ```\n brew install ansible\n ```\n \n For other OS's and additional information on Ansible, see the [Official Ansible Documentation Site](http://docs.ansible.com)\n\n2. AWS SSH Keys\n\n - You need to have your working AWS Keys.  These will be used to enable you to deploy ec2 instances from ansible.\n - If you do not have working keys, visit this link for instructions: [AWS: Creating a Key Pair](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html)\n - Place this key in the filesystem on your laptop - most likely in ~/.ssh\n  - e.g. /Users/mlynn/.ssh/michael.lynn.pem\n - Modify the ansible.cfg file in the top level directory of this repo with the location of your key file.\n  - private_key_file = /Users/mlynn/.ssh/michael.lynn.pem\n\n3. Python VirtualEnvWrapper\n\t- We're going to be leveraging some python libraries.  This can be a maddening cycle of dependencies... unless you leverage a tool like virtualenvwrapper.  First - check this out: [Virtualenvwrapper.readthedocs.io](https://virtualenvwrapper.readthedocs.io/en/latest/)\n\n```\n$ pip install virtualenvwrapper\n\n...\n$ export WORKON_HOME=~/Envs\n$ mkdir -p $WORKON_HOME\n$ source /usr/local/bin/virtualenvwrapper.sh\n$ mkvirtualenv env1\nInstalling\nsetuptools..........................................\n....................................................\n....................................................\n...............................done.\nvirtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env1/bin/predeactivate\nvirtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env1/bin/postdeactivate\nvirtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env1/bin/preactivate\nvirtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env1/bin/postactivate  New python executable in env1/bin/python\n(env1)$ ls $WORKON_HOME\nenv1 hook.log\n```\n\n3. Boto\n\nBoto is a Python package that provides interfaces to Amazon Web Services. Currently, all features work with Python 2.6 and 2.7. Work is under way to support Python 3.3+ in the same codebase.\n\nThis solution leverages the boto library for python for the creation of the ansible-hosts file from the AWS inventory.  To install boto - use the following command:\n\n```\npip install boto3\n```\n\n4. Put your AWS Keys in place - ~/.aws/credentials:\n\n```sh\n[default]\naws_access_key_id = IOEPXX2LODTX4PGGZNJQ\naws_secret_access_key = $DAKS)f94la00s901eBLbAh+7KjFoVZ\n```\n\n5. Create your ansible.cfg file (from the example):\n\n```sh\ncp ansible.cfg.example ansible.cfg\n```\n\n6. Replace the name of your AWS Key in the ansible.cfg file:\n```\n[defaults]\nhost_key_checking = False\nnocows=1\nprivate_key_file = /Users/mlynn/.ssh/michael.lynn.pem \u003c----Location of your key\nlog_path=logs/ansible.log\n\n[ssh_connection]\ncontrol_path = %(directory)s/%%C\n```\n\n7. Put your aws credentials in your .bash_profile\n\n```\nexport AWS_ACCESS_KEY_ID='AYOURKEYHEREKIAJT2LODTX4PGGZNJQ'\nexport AWS_SECRET_ACCESS_KEY='ryYceYOURSECRETKEYHEREBLbAh+7KjFoVZ'\n```\n\nBe certain to source your updated .bash_profile\n\n```\nsource ~/.bash_profile\n```\n\n## Getting Setup\n\nOnce you have the prereqs squared away, you're ready to begin either getting your nodes deployed for demo, or if you already have nodes deployed, you can skip this next section.\n\n### Opsmanager Package\n\n![opsmanager-download.png](https://github.com/mrlynn/ansible-opsmanager-demo/raw/master/opsmanager-download.png?s=200)\n\nIn order for us to deploy Opsmanager, we need to download the opsmanager package from the MongoDB/Downloads site.  Visit [MongoDB/Downloads/Opsmanager](https://www.mongodb.com/download-center#ops-manager) and download the latest package version.  Place the downloaded package RPM in the [files](./files) directory.\n\nAt the time this is being written, the package version is as follows:\n\n```mongodb-mms-3.6.0.582-1.x86_64.rpm```\n\nTo deploy this package, I've hard-coded a reference to this version in the Ansible playbook that installs the package.  If you've downloaded a different version, you will need to update the reference in the playbook.  Here's a look at the playbook:\n\n```\n---\n- hosts: opsManager\n  remote_user: ec2-user\n  become: yes\n  vars:\n    opsmanagerGPG: mongodb-mms-3.4.7.479-1.x86_64.rpm.gpg\n    opsmanager: mongodb-mms-3.6.0.582-1.x86_64.rpm\n  tasks:\n    - copy: src=../files/{{ opsmanager }} dest=/home/ec2-user/{{opsmanager}}\n    - yum: name=/home/ec2-user/{{opsmanager}} state=present\n    - service: name=mongodb-mms state=started\n\n```\n\nChange line 7 to match the name of the version package you've downloaded.\n\n### Node Deployment\n\nAnsible automates the process of package deployment, configuration as well as node deployment.  In this section, we're going to leverage Ansible's ability to connect directly to AWS/EC2 to deploy new instances for our demo.\n\nTo speed things up - I'll leave you to work out those details as we'll not have time to leverage the EC2 Automation for this demo.\n\nSo - You'll want to deploy one M3.xlarge for your Ops Manager machine and 3 t2.small's.  Here's our architecture:\n\n```\n+----------------+                               +---------------+\n|                |                               | (t2.small)    |\n|  OPS MANAGER   |                               |    PRIMARY    |\n|                |                               +---------------+\n| (m3.xlarge)    |       +-----------------------+ OM AGENT      |\n|                |       |                       +-------+-------+\n+---------+------+       |                               |\n          |              |                  +------------+-----------+\n          |              |                  |                        |\n          |              |          +-------v-------+        +-------v-------+\n          |              |          | (t2.small)    |        | (t2.small)    |\n          |              |          |   SECONDARY   |        |   SECONDARY   |\n          |              |          +---------------+        +---------------+\n          +--------------+          | OM AGENT      |        | OM AGENT      |\n          |                         +-------+-------+        +-------+-------+\n          |                                 |                        |\n          |                                 |                        |\n          |                                 |                        |\n          |                                 |                        |\n          +---------------------------------+------------------------+\n\n```\n\n### Deploying Nodes to AWS/EC2\n\nThe first thing we'll need to accomplish is getting our Ops Manager node deployed.  Since the application requirements are pretty decent, we'll leverage an M3 Instance.  Here's what that looks like in terms of resource:\n\nTo deploy your own instances, I've simplified the process of executing the necessary scripts by numbering them logically.\n\n- *Deploy Opsmanager* ([`1_deploy_ec2_opsmgr.sh`](https://github.com/mrlynn/ansible-opsmanager-demo/blob/master/1_deploy_ec2_opsmgr.sh))\n\n\tHere, we're deploying the EC2 instances that will host the Opsmanager software.  You can view the specific documentation to accomplish this independently [here](https://docs.opsmanager.mongodb.com/current/tutorial/install-simple-test-deployment/)\n\n\tThe instance deployed to run Opsmanager will be an m3.xlarge sized instance with an additional 40gb volume created and mounted on /data.  We'll store the backing Opsmanager databases in this volume.\n\n- *Deploy Replicaset Members* ([`2_deploy_ec2_replset.sh`](https://github.com/mrlynn/ansible-opsmanager-demo/blob/master/2_deploy_ec2_replset.sh))\n\n\n- *Create / Update Ansible Hosts File* ([`3_create_ansible-hosts.sh`](https://github.com/mrlynn/ansible-opsmanager-demo/blob/master/3_create_ansible-hosts.sh))\n\n- *Install Opsmanager* ([`4_install_opsmanager.sh`](https://github.com/mrlynn/ansible-opsmanager-demo/blob/master/4_install_opsmanager.sh))\n\n- *Onboard Replica Set Members into Opsmanager* ([`5_onboard_replset.sh`](https://github.com/mrlynn/ansible-opsmanager-demo/blob/master/5_onboard_replset.sh))\n\n## Loading Data for your Demonstration ##\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrlynn%2Fansible-opsmanager-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrlynn%2Fansible-opsmanager-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrlynn%2Fansible-opsmanager-demo/lists"}