All Projects β†’ stone-payments β†’ ansible-mongodb

stone-payments / ansible-mongodb

Licence: MIT license
πŸ“— Ansible role to setup a MongoDB with replica set support

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to ansible-mongodb

.codebits
πŸ“š List of resources for Algorithms and Data Structures in Python & other CS topics @2017
Stars: ✭ 144 (+526.09%)
Mutual labels:  databases
Hera
High Efficiency Reliable Access to data stores
Stars: ✭ 213 (+826.09%)
Mutual labels:  databases
mongodb-replica-set
Run MongoDB Atlas locally for testing
Stars: ✭ 42 (+82.61%)
Mutual labels:  replica-set
Rom
Data mapping and persistence toolkit for Ruby
Stars: ✭ 1,959 (+8417.39%)
Mutual labels:  databases
Awesome Sqlalchemy
A curated list of awesome tools for SQLAlchemy
Stars: ✭ 2,316 (+9969.57%)
Mutual labels:  databases
Tds fdw
A PostgreSQL foreign data wrapper to connect to TDS databases (Sybase and Microsoft SQL Server)
Stars: ✭ 238 (+934.78%)
Mutual labels:  databases
Noproto
Flexible, Fast & Compact Serialization with RPC
Stars: ✭ 138 (+500%)
Mutual labels:  databases
python-pg-extras
Python PostgreSQL database performance insights. Locks, index usage, buffer cache hit ratios, vacuum stats and more.
Stars: ✭ 36 (+56.52%)
Mutual labels:  databases
Migrate
Database migrations. CLI and Golang library.
Stars: ✭ 2,315 (+9965.22%)
Mutual labels:  databases
sqllex
The most pythonic ORM (for SQLite and PostgreSQL). Seriously, try it out!
Stars: ✭ 80 (+247.83%)
Mutual labels:  databases
Ormar
python async mini orm with fastapi in mind and pydantic validation
Stars: ✭ 155 (+573.91%)
Mutual labels:  databases
Wither
An ODM for MongoDB built on the official MongoDB Rust driver.
Stars: ✭ 174 (+656.52%)
Mutual labels:  databases
Prest
PostgreSQL βž• REST, low-code, simplify and accelerate development, ⚑ instant, realtime, high-performance on any Postgres application, existing or new
Stars: ✭ 3,023 (+13043.48%)
Mutual labels:  databases
Atdatabases
TypeScript clients for databases that prevent SQL Injection
Stars: ✭ 154 (+569.57%)
Mutual labels:  databases
libgiddy
Giddy - A lightweight GPU decompression library
Stars: ✭ 39 (+69.57%)
Mutual labels:  databases
Aioinflux
Asynchronous Python client for InfluxDB
Stars: ✭ 142 (+517.39%)
Mutual labels:  databases
Laravel Database Encryption
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Stars: ✭ 238 (+934.78%)
Mutual labels:  databases
adr
Architecture Decision Record (ADR)
Stars: ✭ 21 (-8.7%)
Mutual labels:  databases
sqli
A Laravel Artisan SQL Interactive Interface
Stars: ✭ 60 (+160.87%)
Mutual labels:  databases
Hyperspace
An open source indexing subsystem that brings index-based query acceleration to Apache Sparkβ„’ and big data workloads.
Stars: ✭ 246 (+969.57%)
Mutual labels:  databases

stone-payments.mongodb

Build Status

Role for Ansible which manages MongoDB in a standalone setup or replica set.

Supported systems

To conserve development efforts, we decided that a supported distro should:

  • be currently supported by the distro-maker (aka not in EOL);
  • be currently supported by MongoDB.org (this requirement will probably be dropped soon);
  • be systemd-based;
  • have a wide-enough user-base.

Therefore, the supported systems list is currently:

  • Enterprise Linux (both CentOS and RHEL)
    • 7.3
    • 7.4
    • 7.5
  • Ubuntu
    • 16.04

Further distros may be added upon request, as long as the requirements are met.

Usage

Quickstart

There's absolute no variable needed to setup a basic, passwordless, loopback-only, standalone MongoDB setup. Just include it in a play:

- name: install mongodb
  hosts: all
  roles: stone-payments.mongodb

Replica set setup

In order to build a replica set, you need to inform the master that he is a master, and a replica on which master to connect to. You can do all this with the following excerpt:

- name: install mongodb replica set
  host: all
  roles: stone-payments.mongodb
  vars:
    mongodb_conf_bindIp: "0.0.0.0"
    mongodb_replSet_enabled: true
    mongodb_replSet_name: "someReplicaSetName"
    mongodb_replSet_master: "1.2.3.4" #must be an IP address
    mongodb_replSet_key: "someLongKey" #optional, cross-replica authentication key
    mongodb_replSet_member: "{{ ansible_eth1['ipv4']['address'] }}" #optional, specify a different IF for replication
    mongodb_replSet_arbiter: "{{ true if inventory_hostname == 'hostThatIsArbiter' else false }}"

Authentication

You can enable authentication and create an admin account the following way:

- name: install mongodb with authentication
  hosts: all
  roles: stone-payments.mongodb
  vars:
    mongodb_conf_auth: true
    mongodb_admin_user: "admin"
    mongodb_admin_password: "somePassword"

Logging

You can set any systemLog option by providing mongodb_conf_logging dictionary:

- name: install mongodb with network debug logging
  host: all
  roles: stone-payments.mongodb
  vars:
    mongodb_conf_logging:
      verbosity: 0
      component:
        network:
          verbosity: 5
      destination: file
      path: /var/log/mongodb/mongod.log

Firewall

This rule will configure either ufw or firewalld to enable incoming connections by default. You may customize this with the following options (which are specific to the firewall solution you're utilizing):

- name: install mongodb with custom firewall settings
  hosts: all
  roles: stone-payments.mongodb
  vars:
    mongodb_firewall_zone: "public" #firewalld only
    mongodb_firewall_interface: "eth0" #ufw only
    mongodb_firewall_source: "192.168.0.0/24" #ufw only

You may also suppress firewall config by setting mongodb_install_firewall: false.

Linux Security Modules

This role will configure LSMs by default (currently only SELinux is supported). You may disable this by setting: mongodb_install_lsm: false.

Other configs

I believe almost every other config is self-explanatory or directly related to a MongoDB core feature. Simply override the configs on defaults/main.yml and they will be (hopefully) applied to your system.

Testing

This role implements most unit tests with Molecule on Docker. Notice that we only support Molecule 2.0 or greater. Some tests are implemented on Vagrant with VirtualBox so we can test aspects that require a full-blown VM. However, for the tests that require Vagrant, there's no CI integration since there isn't a public CI that supports nested virtualization.

The following scenarios are present:

Scenario Name Driver Description
default docker Basic role sanity tests in a individual setup
replica-set docker Mixed distro setup in a replica set
security vagrant Full-blown VM to test LSM and firewall config

Docker environment setup

You can install Molecule and the Docker interaction library inside a virtual environment with the following commands. Notice that we need docker-py both inside and outside the virtualenv.

sudo pip install docker-py
virtualenv .venv
.venv/bin/activate
pip install molecule docker-py

The Docker installation and configuration is out of scope.

If you have a SELinux-enabled host, you must also have the libselinux-python library installed. There's a special addition in the Molecule playbook when delegating tasks to localhost to use the host's python interpreter instead of the virtualenv python in order to properly access the SELinux bindings. You can install this package both on Fedora and CentOS with:

sudo yum install python2-libselinux

Vagrant environment setup

You can install Molecule inside a virtual environment with the following commands:

virtualenv .venv
.venv/bin/activate
pip install molecule

The Vagrant and VirtualBox installation and configuration is out of scope.

Running the test

After having Molecule setup within the virtualenv, you can run the tests with:

molecule converge [-s scenario_name]

Where scenario_name is the name of a test case under molecule. The default test case is run if no parameter is passed.

Contributing

Just open a PR. We love PRs!

To Do List

Here's some suggestions on what to do:

  • Support use of distro-packaged MongoDB.
  • Write further standalone tests with serverspec or testinfra.
  • Improve the test case for the replica set.

License

This role is distributed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].