William-Yeh.mongodb
williamyeh.mongodb for Ansible Galaxy
Summary
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).
Role Variables
Mandatory variables
None.
Optional variables
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
Handlers
mongod:
restart mongodreload mongodstop mongod
mongos:
restart mongosreload mongosstop mongos
Usage
Step 1: add role
Add role name williamyeh.mongodb to your playbook file.
Step 2: add variables
Set vars in your playbook file.
Simple example:
---
# file: simple-playbook.yml
- hosts: all
roles:
- williamyeh.mongodb
vars:
mongodb_version: 3.0.4
Step 3: copy user's config files, if necessary
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"
Dependencies
None.
License
MIT License. See the LICENSE file for details.
History
Rewritten from my pre-Galaxy version: server-config-template.
Install
ansible-galaxy install William-Yeh.mongodbLicense
mit
Downloads
219
Owner
