Merge pull request #6 from quarkslab/feature/install_from_debian_repo

Add possibility for User to install from Official Debian or Ubuntu Repo.
This commit is contained in:
Kirill Klenov 2015-01-07 14:05:07 +03:00
commit 8feff52662
5 changed files with 32 additions and 19 deletions

View File

@ -15,12 +15,14 @@ Ansible role which manage [MongoDB](http://www.mongodb.org/)
```yaml ```yaml
mongodb_enabled: yes mongodb_enabled: yes
mongodb_packages: mongodb_from_mongodb_repo: yes # If yes, install using MongoDB repo, else use system default repo
- python-selinux
- python-pymongo mongodb_additional_packages:
- mongodb-org - python-selinux
- python-pymongo
mongodb_user: mongodb mongodb_user: mongodb
mongodb_daemon_name: "{{ 'mongod' if (mongodb_from_mongodb_repo | bool) else 'mongodb' }}"
mongodb_conf_auth: no # Run with security mongodb_conf_auth: no # Run with security
mongodb_conf_bind_ip: 127.0.0.1 # Comma separated list of ip addresses to listen on 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_ipv6: no # Enable IPv6 support (disabled by default)
mongodb_conf_journal: no # Enable journaling mongodb_conf_journal: no # Enable journaling
mongodb_conf_logappend: yes # Append to logpath instead of over-writing 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_maxConns: 1000000 # Max number of simultaneous connections
mongodb_conf_noprealloc: no # Disable data file preallocation mongodb_conf_noprealloc: no # Disable data file preallocation
mongodb_conf_noscripting: no # Disable scripting engine mongodb_conf_noscripting: no # Disable scripting engine

View File

@ -1,12 +1,14 @@
--- ---
mongodb_enabled: yes mongodb_enabled: yes
mongodb_packages: mongodb_from_mongodb_repo: yes # If yes, install using MongoDB repo, else use system default repo
- python-selinux
- python-pymongo mongodb_additional_packages:
- mongodb-org - python-selinux
- python-pymongo
mongodb_user: mongodb mongodb_user: mongodb
mongodb_daemon_name: "{{ 'mongod' if (mongodb_from_mongodb_repo | bool) else 'mongodb' }}"
mongodb_conf_auth: no # Run with security mongodb_conf_auth: no # Run with security
mongodb_conf_bind_ip: 127.0.0.1 # Comma separated list of ip addresses to listen on 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_ipv6: no # Enable IPv6 support (disabled by default)
mongodb_conf_journal: no # Enable journaling mongodb_conf_journal: no # Enable journaling
mongodb_conf_logappend: yes # Append to logpath instead of over-writing 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_maxConns: 1000000 # Max number of simultaneous connections
mongodb_conf_noprealloc: no # Disable data file preallocation mongodb_conf_noprealloc: no # Disable data file preallocation
mongodb_conf_noscripting: no # Disable scripting engine mongodb_conf_noscripting: no # Disable scripting engine

View File

@ -1,10 +1,10 @@
--- ---
- name: mongodb reload - name: mongodb reload
service: name=mongod state=reloaded service: name={{ mongodb_daemon_name }} state=reloaded
- name: mongodb restart - name: mongodb restart
service: name=mongod state=restarted service: name={{ mongodb_daemon_name }} state=restarted
- name: mongodb-mms-automation-agent restart - name: mongodb-mms-automation-agent restart
service: name=mongodb-mms-automation-agent state=restarted service: name=mongodb-mms-automation-agent state=restarted

View File

@ -2,15 +2,24 @@
- name: Add APT key - name: Add APT key
apt_key: url=http://docs.mongodb.org/10gen-gpg-key.asc id=7F0CEB10 apt_key: url=http://docs.mongodb.org/10gen-gpg-key.asc id=7F0CEB10
when: mongodb_from_mongodb_repo | bool
- name: Add APT repository (Ubuntu) - name: Add APT repository (Ubuntu)
apt_repository: repo='deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' update_cache=yes 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) - name: Add APT repository (Debian)
apt_repository: repo='deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen' update_cache=yes 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}} apt: pkg={{item}}
with_items: mongodb_packages with_items: mongodb_additional_packages

View File

@ -6,7 +6,7 @@
- include: configure.yml - include: configure.yml
- name: Ensure mongodb is started - name: Ensure mongodb is started
service: name=mongod state=started enabled=yes service: name={{ mongodb_daemon_name }} state=started enabled=yes
changed_when: False changed_when: False
- include: mms-agent.yml - include: mms-agent.yml