UnderGreen.mongodb
Ansible Role for MongoDB
This is an Ansible role that helps you install and manage MongoDB.
Features
- Install and configure MongoDB
- Manage MongoDB users
- Set up authentication
- Enable replication
- Install MMS automation agent
Supported MongoDB Versions
Distribution | < MongoDB 3.4 | MongoDB 3.6 | MongoDB 4.0 | MongoDB 4.2 | MongoDB 4.4 |
---|---|---|---|---|---|
Ubuntu 16.04 | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: |
Ubuntu 18.04 | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: |
Ubuntu 20.04 | :no_entry: | :x: | :x: | :x: | :white_check_mark: |
Debian 9.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
Debian 10.x | :no_entry: | :x: | :x: | :white_check_mark: | :white_check_mark: |
RHEL 7.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
RHEL 8.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
Amazon Linux 2 | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
- :white_check_mark: Fully tested
- :x: No official support
- :no_entry: MongoDB is no longer supported
Variables
# MongoDB installation source.
# 'mongodb' - version from Debian-based repos.
# 'mongodb-org' - version from MongoDB repo.
mongodb_package: mongodb-org
# MongoDB version to install. Options: '3.6', '4.0', '4.2', '4.4'.
mongodb_version: "4.4"
mongodb_pymongo_from_pip: true # Install latest PyMongo via PIP
mongodb_user_update_password: "on_create" # Update policy for MongoDB user passwords
mongodb_manage_service: true
mongodb_manage_systemd_unit: true
# Disable transparent hugepages for systemd in Debian-based installs.
mongodb_disable_transparent_hugepages: false
# Enable or disable NUMA support.
mongodb_use_numa: true
mongodb_user: "{{ 'mongod' if ('RedHat' == ansible_os_family) else 'mongodb' }}"
mongodb_daemon_name: "{{ 'mongod' if ('mongodb-org' in mongodb_package) else 'mongodb' }}"
# Network options
mongodb_net_bindip: 127.0.0.1 # IP addresses MongoDB listens on
mongodb_net_http_enabled: false # Enable HTTP interface
mongodb_net_maxconns: 65536 # Max simultaneous connections
mongodb_net_port: 27017 # Port number
# Security options
mongodb_security_authorization: "disabled" # Enable or disable security
mongodb_security_keyfile: /etc/mongodb-keyfile # Path for keyfile used for authentication
# Storage options
mongodb_storage_dbpath: /data/db # Data files location
mongodb_storage_engine: "wiredTiger" # Storage engine
# System log options
mongodb_systemlog_destination: "file" # Where MongoDB sends logs
mongodb_systemlog_path: /var/log/mongodb/{{ mongodb_daemon_name }}.log # Log file path
# Replication options
mongodb_replication_replset: # Enable replication
mongodb_replication_oplogsize: 1024 # Max size for replication log in MB
# MMS Agent settings
mongodb_mms_agent_pkg: URL to MMS agent package
mongodb_mms_base_url: https://mms.mongodb.com
# Administrative user names and passwords
mongodb_user_admin_name: siteUserAdmin
mongodb_user_admin_password: passw0rd
mongodb_root_admin_name: siteRootAdmin
mongodb_root_admin_password: passw0rd
Usage
Add undergreen.mongodb
to your roles and set variables in your playbook.
Example Settings for Users:
mongodb_security_authorization: "enabled"
mongodb_users:
- {
name: testUser,
password: passw0rd,
roles: readWrite,
database: app_development
}
Required Variables for Production:
mongodb_user_admin_password
mongodb_root_admin_password
mongodb_root_backup_password
Example for Replication:
# MongoDB master node
mongodb_login_host: 192.168.56.2
mongodb_replication_params:
- {
host_name: 192.168.56.2,
host_port: "{{ mongodb_net_port }}",
host_type: replica,
}
Inventory File for Replica Set:
[mongo_master]
192.168.56.2 mongodb_master=True
[mongo_replicas]
192.168.56.3
192.168.56.4
[mongo:children]
mongo_master
mongo_replicas
Licensed under the GPLv2 License. See the LICENSE.md file for more details.
Feedback and Issues
Feedback and bug reports are welcome here!
Informazioni sul progetto
Manage MongoDB with authentication and replica sets
Installa
ansible-galaxy install UnderGreen.mongodb
Licenza
gpl-2.0
Download
299.6k
Proprietario