-
-
Save algotrader-dotcom/a045a6c99ccdcf47b6b380cb8ddf295c to your computer and use it in GitHub Desktop.
Ansible Playbook to setup MongoDB on Ubuntu 14.04 (ubuntu/trusty64)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
sudo: true | |
vars: | |
mongodb_version: 3.0.7 | |
tasks: | |
- name: MongoDB | Import the public key used by the package management system | |
apt_key: keyserver=keyserver.ubuntu.com id=7F0CEB10 | |
- name: MongoDB | Create a list file | |
lineinfile: dest=/etc/apt/sources.list.d/mongodb-org-3.0.list line="deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.0 multiverse" state=present create=yes | |
- name: MongoDB | Install the packages | |
apt: name={{ item }}={{ mongodb_version }} state=present update_cache=yes | |
with_items: | |
- mongodb-org | |
- mongodb-org-server | |
- mongodb-org-shell | |
- mongodb-org-mongos | |
- mongodb-org-tools | |
notify: | |
- restart mongodb | |
- name: MongoDB | Listen to all interfaces | |
lineinfile: "dest=/etc/mongod.conf regexp='^ bindIp: 127.0.0.1' state=absent" | |
notify: | |
- restart mongodb | |
handlers: | |
- name: restart mongodb | |
service: name=mongod state=restarted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment