Add possibility for User to install from Official Debian or Ubuntu Repo.
Support new variable and due to difference between Debian/Ubuntu repo and MongoDB, daemon and file convention naming are differents.
This commit is contained in:
parent
a4514cad64
commit
8769e8a411
14
README.md
14
README.md
|
@ -15,12 +15,14 @@ Ansible role which manage [MongoDB](http://www.mongodb.org/)
|
|||
```yaml
|
||||
|
||||
mongodb_enabled: yes
|
||||
mongodb_packages:
|
||||
- python-selinux
|
||||
- python-pymongo
|
||||
- mongodb-org
|
||||
mongodb_from_mongodb_repo: yes # If yes, install using MongoDB repo, else use system default repo
|
||||
|
||||
mongodb_additional_packages:
|
||||
- python-selinux
|
||||
- python-pymongo
|
||||
|
||||
mongodb_user: mongodb
|
||||
mongodb_daemon_name: "{{ 'mongod' if (mongodb_from_mongodb_repo | bool) else 'mongodb' }}"
|
||||
|
||||
mongodb_conf_auth: no # Run with security
|
||||
mongodb_conf_bind_ip: 127.0.0.1 # Comma separated list of ip addresses to listen on
|
||||
|
@ -31,7 +33,7 @@ mongodb_conf_httpinterface: no # Enable http interface
|
|||
mongodb_conf_ipv6: no # Enable IPv6 support (disabled by default)
|
||||
mongodb_conf_journal: no # Enable journaling
|
||||
mongodb_conf_logappend: yes # Append to logpath instead of over-writing
|
||||
mongodb_conf_logpath: /var/log/mongodb/mongod.log # Log file to send write to instead of stdout
|
||||
mongodb_conf_logpath: /var/log/mongodb/{{ mongodb_daemon_name }}.log # Log file to send write to instead of stdout
|
||||
mongodb_conf_maxConns: 1000000 # Max number of simultaneous connections
|
||||
mongodb_conf_noprealloc: no # Disable data file preallocation
|
||||
mongodb_conf_noscripting: no # Disable scripting engine
|
||||
|
@ -49,7 +51,7 @@ mongodb_shell: {} # Define mongo shell commands
|
|||
# Syntax: mongodb_shell:
|
||||
# dbname:
|
||||
# - db.setProfilingLevel(1, 50)
|
||||
|
||||
|
||||
|
||||
# MMS Agent
|
||||
mongodb_mms_agent_pkg: https://mms.mongodb.com/download/agent/automation/mongodb-mms-automation-agent-manager_1.4.2.783-1_amd64.deb
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
---
|
||||
|
||||
mongodb_enabled: yes
|
||||
mongodb_packages:
|
||||
- python-selinux
|
||||
- python-pymongo
|
||||
- mongodb-org
|
||||
mongodb_from_mongodb_repo: yes # If yes, install using MongoDB repo, else use system default repo
|
||||
|
||||
mongodb_additional_packages:
|
||||
- python-selinux
|
||||
- python-pymongo
|
||||
|
||||
mongodb_user: mongodb
|
||||
mongodb_daemon_name: "{{ 'mongod' if (mongodb_from_mongodb_repo | bool) else 'mongodb' }}"
|
||||
|
||||
mongodb_conf_auth: no # Run with security
|
||||
mongodb_conf_bind_ip: 127.0.0.1 # Comma separated list of ip addresses to listen on
|
||||
|
@ -17,7 +19,7 @@ mongodb_conf_httpinterface: no # Enable http interface
|
|||
mongodb_conf_ipv6: no # Enable IPv6 support (disabled by default)
|
||||
mongodb_conf_journal: no # Enable journaling
|
||||
mongodb_conf_logappend: yes # Append to logpath instead of over-writing
|
||||
mongodb_conf_logpath: /var/log/mongodb/mongod.log # Log file to send write to instead of stdout
|
||||
mongodb_conf_logpath: /var/log/mongodb/{{ mongodb_daemon_name }}.log # Log file to send write to instead of stdout
|
||||
mongodb_conf_maxConns: 1000000 # Max number of simultaneous connections
|
||||
mongodb_conf_noprealloc: no # Disable data file preallocation
|
||||
mongodb_conf_noscripting: no # Disable scripting engine
|
||||
|
@ -35,7 +37,7 @@ mongodb_shell: {} # Define mongo shell commands
|
|||
# Syntax: mongodb_shell:
|
||||
# dbname:
|
||||
# - db.setProfilingLevel(1, 50)
|
||||
|
||||
|
||||
|
||||
# MMS Agent
|
||||
mongodb_mms_agent_pkg: https://mms.mongodb.com/download/agent/automation/mongodb-mms-automation-agent-manager_1.4.2.783-1_amd64.deb
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
|
||||
- name: mongodb reload
|
||||
service: name=mongod state=reloaded
|
||||
service: name={{ mongodb_daemon_name }} state=reloaded
|
||||
|
||||
- name: mongodb restart
|
||||
service: name=mongod state=restarted
|
||||
service: name={{ mongodb_daemon_name }} state=restarted
|
||||
|
||||
- name: mongodb-mms-automation-agent restart
|
||||
service: name=mongodb-mms-automation-agent state=restarted
|
||||
|
|
|
@ -2,15 +2,24 @@
|
|||
|
||||
- name: Add APT key
|
||||
apt_key: url=http://docs.mongodb.org/10gen-gpg-key.asc id=7F0CEB10
|
||||
when: mongodb_from_mongodb_repo | bool
|
||||
|
||||
- name: Add APT repository (Ubuntu)
|
||||
apt_repository: repo='deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' update_cache=yes
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
when: ansible_distribution == 'Ubuntu' and (mongodb_from_mongodb_repo | bool)
|
||||
|
||||
- name: Add APT repository (Debian)
|
||||
apt_repository: repo='deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen' update_cache=yes
|
||||
when: ansible_distribution == 'Debian'
|
||||
when: ansible_distribution == 'Debian' and (mongodb_from_mongodb_repo | bool)
|
||||
|
||||
- name: Install mongodb-org
|
||||
- name: Install MongoDB package from MongoDB repo
|
||||
apt: pkg=mongodb-org state=present
|
||||
when: mongodb_from_mongodb_repo | bool
|
||||
|
||||
- name: Install MongoDB package from Ubuntu or Debian official repo
|
||||
apt: pkg=mongodb state=present
|
||||
when: not (mongodb_from_mongodb_repo | bool)
|
||||
|
||||
- name: Install additional packages
|
||||
apt: pkg={{item}}
|
||||
with_items: mongodb_packages
|
||||
with_items: mongodb_additional_packages
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
- include: configure.yml
|
||||
|
||||
- name: Ensure mongodb is started
|
||||
service: name=mongod state=started enabled=yes
|
||||
service: name={{ mongodb_daemon_name }} state=started enabled=yes
|
||||
changed_when: False
|
||||
|
||||
- include: mms-agent.yml
|
||||
|
|
Loading…
Reference in New Issue