Role name in Ansible Galaxy: williamyeh.mongodb
This Ansible role has the following features for MongoDB:
- Install specific version;
- Handlers for restart/reload/stop events;
- Bare bone configuration (real configuration should be left to user's template files; see Usage section below).
None.
User-configurable defaults:
# MongoDB version; e.g., "3.0.4"
# Will install the default (usually the latest stable) version, if not specified.
mongodb_version
# which components to install?
# possible values:
# - "mongod"
# - "mongos"
mongodb_components: [ "mongod" ]
# install mongod as a config server?
mongodb_configsvr: false
# TCP port of config server
mongodb_configsvr_port: 27019
# use `service` command to start/restart mongodb daemon?
mongodb_use_service: True
User-installable configuration files (by Ansible's template system):
# mongod conf template to be installed to "/etc/mongod.conf";
# relative to `playbook_dir`
mongodb_mongod_conf
# mongos conf template to be installed to "/etc/mongos.conf";
# relative to `playbook_dir`
mongodb_mongos_conf
mongod:
restart mongod
reload mongod
stop mongod
mongos:
restart mongos
reload mongos
stop mongos
Add role name williamyeh.mongodb
to your playbook file.
Set vars in your playbook file.
Simple example:
---
# file: simple-playbook.yml
- hosts: all
roles:
- williamyeh.mongodb
vars:
mongodb_version: 3.0.4
More practical example:
---
# file: complex-playbook.yml
- hosts: all
roles:
- williamyeh.mongodb
vars:
mongodb_version: 3.0.4
mongodb_mongod_conf: "templates/mongod.conf.j2"
None.
MIT License. See the LICENSE file for details.
Rewritten from my pre-Galaxy version: server-config-template.