iquzart.mongodb

Ansible MongoDB

Ansible Rolle für die MongoDB-Konfiguration mit Unterstützung für Replikasätze.

Funktionen

    - Unterstützung für CentOS und Ubuntu
    - Konfiguration in Standalone- und Replikatsatzmodus
    - Konfiguration von SELinux auf CentOS
    - Konfiguration von Firewalld 
    - Der Speicherort der MongoDB-Konfigurationsdatei kann in ein benutzerdefiniertes Verzeichnis geändert werden
    - Benutzerdefinierte Datenbank- und Protokolldateien
    - Aktivieren/Deaktivieren der Authentifizierung (standardmäßig aktiviert und empfohlen)
    - Erstellen von Benutzern - Root, DBAdmin, Backup Admin
    - Replikatpriorität kann konfiguriert werden
    - SCARM-Authentifizierung

Unterstützungsmatrix

Distribution MongoDB 4.4 MongoDB 4.3
CentOS 8 Unterstützt (Getestet) Unterstützt (Nicht Getestet)
CentOS 7 Unterstützt (Getestet) Unterstützt (Nicht Getestet)
Ubuntu 20.04 LTS Unterstützt (Getestet) Unterstützt (Nicht Getestet)
Ubuntu 19.04 LTS Unterstützt (Getestet) Unterstützt (Nicht Getestet)

Rollenvariablen

# MongoDB Version
mongodb_install_version_major: 4
mongodb_install_version_minor: 4
mongodb_install_version_patch: "*"

# CentOS
mongodb_enable_yum_repository: true
mongodb_install_package_lock: true

# Ubuntu
mongodb_enable_apt_repository: true

# SELinux-Konfiguration (nur auf CentOS)
configure_selinux: True

# MongoDB-Konfiguration
mongodb_conf_file: /etc/mongodb/mongod.conf            
mongodb_conf_db_dir: /data/mongo-data
mongodb_conf_log_dir: /var/log/mongodb                 
mongodb_conf_dbEngine: wiredTiger                      
mongodb_conf_auth: true                                
mongodb_conf_bindIp: "0.0.0.0"                       
mongodb_conf_journal: true                             
mongodb_conf_maxConns: 64000                           
mongodb_conf_port: 27017                               
mongodb_conf_oplogSize: 1024
mongodb_conf_cloudmonitoring: "off"

# Systemd-Einheiten
mongodb_daemon_unitfile: /etc/systemd/system/mongod.service 

# Replikatsatzkonfiguration 
mongodb_replication_enabled: true   # false erstellt eine Standalone-MongoDB-Instanz
mongodb_replication_key_file: /etc/mongodb/repl.key
mongodb_replication_set_name: rs01

# PyMongo-Konfiguration                 
mongodb_pymongo_pip_version: 3.7.1

# Kontokconfiguration
mongodb_root_account: root
mongodb_root_password: "p@ssw0rd"

mongodb_admin_account: dbadmin
mongodb_admin_password: "p@ssw0rd"

mongodb_backup_account: backupadmin
mongodb_backup_password: "p@ssw0rd"

Beispiel-Playbook

  - name: Mongo DB Setup 
    hosts: mongo
    remote_user: root
    become: yes

    roles:
      - mongodb-replicaset

Host-Inventar

all:
    hosts:
    children:
        mongo:
            hosts:
                mongo-01.example.com:
                    host_name: mongodb-01
                    host_ip: "192.168.122.201"
                mongo-02.example.com:
                    host_name: mongodb-02
                    host_ip: "192.168.122.202"
                mongo-03.example.com:
                    host_name: mongodb-03
                    host_ip: "192.168.122.203"
        master:
            hosts:
                mongo-01.example.com:
        replicas:
            hosts:
                mongo-02.example.com:
                    priority: 1
                mongo-03.example.com:
                    priority: 1
        arbiter:
            hosts:
#                mongo-03.example.com:
#                    priority: 0

Optionale Anforderungen

Lizenz

MIT

To-Do

  1. TLS-Unterstützung
  2. x509 Auth Unterstützung

Autoreninformation

Muhammed Iqbal iquzart@hotmail.com

Über das Projekt

Install MongoDB standalone or Replicaset

Installieren
ansible-galaxy install iquzart.mongodb
GitHub Repository
Lizenz
Unknown
Downloads
69
Besitzer
Open Source Enthusiast