• Stars
    star
    106
  • Rank 323,927 (Top 7 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 4 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

MongoDB Ansible Collection

MongoDB Version and PyMongoDB Version Compatibility

  • This collection is tested against the most recent two minor MongoDB releases, currently 5.0.X and 6.0.X.
  • This collection is tested against PyMongo version 3.12.X and latest. PyMongo 3.12.X dropped on 11.04.2023. Now PyMongo latest only.
  • This collection will not run against any MongoDB version lower than 4.0. You can set strict_compatibility to false to override this behaviour but don't expect 100% success. It might be a better approach to use an older release of this collection (1.3.4 or earlier) if you're using an old MongoDB version (3.6 or earlier).
  • Compatibility may be maintained for older software versions but is not guaranteed. Please upgrade your PyMongo driver version if you encounter difficulties with older versions.
  • Support for PyMongo versions less than 4.X will be dropped in the future. Drop support for pymongo < 4.0? - Support for Pymongo < 4.0 now dropped from collection version 1.5.0

Mongodb Collection

Category Status
Github CI CI
Codecov Codecov
CI Roles CI_roles
Latest Build Build & Publish Collection

This collection called mongodb aims at providing all Ansible modules allowing to interact with MongoDB. The modules present in Ansible 2.9 are included in this collection and will benefit from the evolutions and quality requirements from this collection.

As this is an independent collection, it can be released on its own release cadence.

If you like this collection please give us a rating on Ansible Galaxy.

Collection contents

Roles

These roles prepare servers with Debian-based and RHEL-based distributions to run MongoDB. These roles should not be used to manage MongoDB instances that have been previously installed or configured through other means.

  • community.mongodb.mongodb_linux: A simple role to configure Linux Operating System settings, as advised in the MongoDB Production Notes.

  • community.mongodb.mongodb_selinux: Configure SELinux for MongoDB.

  • community.mongodb.mongodb_repository: Configures a package repository for MongoDB on Debian and RedHat based platforms.

  • community.mongodb.mongodb_install: Install MongoDB packages on Debian and RedHat based platforms. This role, unlike all other roles, provides for installing specific versions of mongodb-org packages. Other roles merely validate that mongodb-org is installed/present; they do not install particular versions.

These roles manage configuring and starting various MongoDB services.

  • community.mongodb.mongodb_mongod: Configure the mongod service (includes populating mongod.conf) which is a MongoDB replicaset or standalone server.
  • community.mongodb.mongodb_mongos: Configure the mongos service (includes populating mongos.conf) which only runs in a sharded MongoDB cluster.
  • community.mongodb.mongodb_config: Configure the CSRS Config Server Replicaset for a MongoDB sharded cluster. The CSRS is a special-purpose instance of mongod that hosts the config database for the sharded cluster. For standalone installations, please use the mongodb_mongod role instead.
  • community.mongodb.mongodb_auth: Configure auth on MongoDB servers. NB: The other MongoDB server config roles (mongodb_mongod, mongodb_mongos, mongodb_config) do not configure auth. Use this role in conjunction with the other roles.

Plugins

Lookup Plugins

  • community.mongodb.mongodb: A lookup plugin that gets info from a collection using the MongoDB find() function.

Cache Plugins

  • community.mongodb.mongodb: A cache plugin that stores the host fact cache records in MongoDB.

Modules

These modules are for any MongoDB cluster (standalone, replicaset, or sharded):

  • community.mongodb.mongodb_index: Creates or drops indexes on MongoDB collections.
  • community.mongodb.mongodb_info: Gather information about MongoDB instance.
  • community.mongodb.mongodb_oplog: Resizes the MongoDB oplog (MongoDB 3.6+ only).
  • community.mongodb.mongodb_parameter: Change an administrative parameter on a MongoDB server.
  • community.mongodb.mongodb_role: Manage MongoDB Roles.
  • community.mongodb.mongodb_schema: Manages MongoDB Document Schema Validators.
  • community.mongodb.mongodb_shell: Run commands via the MongoDB shell.
  • community.mongodb.mongodb_shutdown: Cleans up all database resources and then terminates the mongod/mongos process.
  • community.mongodb.mongodb_user: Adds or removes a user from a MongoDB database.

These modules are only useful for replicaset (or sharded) MongoDB clusters:

  • community.mongodb.mongodb_maintenance: Enables or disables maintenance mode for a secondary member.
  • community.mongodb.mongodb_replicaset: Initialises a MongoDB replicaset.
  • community.mongodb.mongodb_status: Validates the status of the replicaset.
  • community.mongodb.mongodb_stepdown: Step down the MongoDB node from a PRIMARY state.

These modules are only useful for sharded MongoDB clusters:

  • community.mongodb.mongodb_balancer: Manages the MongoDB Sharded Cluster Balancer.
  • community.mongodb.mongodb_shard: Add or remove shards from a MongoDB Cluster.
  • community.mongodb.mongodb_shard_tag: Manage Shard Tags.
  • community.mongodb.mongodb_shard_zone: Manage Shard Zones.

These modules are only useful for MongoDB Atlas clusters:

  • community.mongodb.mongodb_atlas_cluster: Manage MongoDB clusters in Atlas.
  • community.mongodb.mongodb_atlas_ldap_user: Manage LDAP users in Atlas.
  • community.mongodb.mongodb_atlas_user: Manage users in Atlas.
  • community.mongodb.mongodb_atlas_whitelist: Manage IP whitelists in Atlas.

community.mongodb Role Tags

General role tags

These tags are applicable across all roles.

tags comment
mongodb Tasks specific to MongoDB.
debian Tasks specific to Debian Family Operating Systems.
redhat Tasks specific to RedHat Family Operating Systems.
pip Tasks working with pip.
vars Tasks that load variables.
pkg Tasks that install packages.
debug Tasks that output debugging info.
service Tasks dealing with system services.
setup Tasks that are mainly executed during initial deployment.
ci Tasks that are specific to the community.mongodb CI code.
linux Tasks affecting Linux OS settings.

Role Specific Tags

These tags apply to the specific roles as indicated.

role tag comment
mongodb_auth admin_user Tasks that work with the MongoDB Administrator user.
mongodb_auth app_user Tasks that work with MongoDB app users.

Usage Examples

The following links provide various examples for how the community.mongodb roles and modules can be used in real projects.

Running the integration and unit tests

The ansible-test tool requires a specific directory hierarchy to function correctly so please follow carefully.

  • Create the required directory structure. N-B. The ansible-test tool requires this format.
mkdir -p git/ansible_collections/community
cd git/ansible_collections/community
  • Clone the required projects.
git clone  https://github.com/ansible-collections/community.mongodb.git ./mongodb
git clone  https://github.com/ansible-collections/community.general.git ./general
  • Create and activate a virtual environment.
virtualenv venv
source venv/bin/activate
  • Change to the project directory.
cd mongodb
  • Install the devel branch of ansible-base.
pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
  • Run integration tests for the mongodb_shard module.
ansible-test integration --docker default -v --color --python 3.6 mongodb_shard
  • Run integration tests for the mongodb_status module.
ansible-test integration --docker default -v --color --python 3.6 mongodb_status
  • Run integration tests for the mongodb_oplog module.
ansible-test integration --docker ubuntu1804 -v --color --python 3.6 mongodb_oplog
  • Run tests for everything in the collection.
ansible-test integration --docker default -v --color --python 3.6
  • Run the units tests
ansible-test units --docker default -v --color --python 3.6

Release Notes

Needs improvement but the general process for issuing a new release to Ansible Galaxy is as follows...

  • View commits since last release and copy text for release notes
git log 1.3.0..HEAD
git log 1.3.0..HEAD --oneline
  • Create a new branch
  • Update galaxy.yml with version and any other appropriate info
  • Update changelogs/changelog.yaml
  • Update CHANGELOG.rst
  • Create a pull request
  • Review and merge when happy
  • Tag release on the master branch
git tag <release>
git push --tags

Automation will bundle the release and push to Galaxy. Should take around 10-15 minutes.

GitHub workflow

  • Maintainers would be members of this GitHub Repo
  • Branch protections could be used to enforce 1 (or 2) reviews from relevant maintainers CODEOWNERS

Contributing

Any contribution is welcome and we only ask contributors to:

  • Provide at least integration tests for any contribution.
  • Create an issue for any significant contribution that would change a large portion of the codebase.
  • Unless there's a very good reason for it, i.e. it's a bug, we aim not to change default behaviour.

Stargazers over time

Stargazers over time

License

GNU General Public License v3.0 or later

See LICENSING to see the full text.

More Repositories

1

community.general

Ansible Community General Collection
Python
810
star
2

community.vmware

Ansible Collection for VMware
Python
341
star
3

community.zabbix

Zabbix Ansible modules
Python
318
star
4

amazon.aws

Ansible Collection for Amazon AWS
Python
279
star
5

cisco.ios

Ansible Network Collection for Cisco IOS
Python
277
star
6

community.kubernetes

Kubernetes Collection for Ansible
Makefile
265
star
7

overview

Collections overview, how to request a namespace
249
star
8

azure

Development area for Azure Collections
Python
245
star
9

ansible.windows

Windows core collection for Ansible
PowerShell
242
star
10

kubernetes.core

The collection includes a variety of Ansible content to help automate the management of applications in Kubernetes and OpenShift clusters, as well as the provisioning and maintenance of clusters themselves.
Python
210
star
11

community.windows

Windows community collection for Ansible
PowerShell
198
star
12

community.docker

Community Docker Collection for Ansible: modules and plugins for working with Docker
Python
196
star
13

community.aws

Ansible Collection for Community AWS
Python
187
star
14

ansible.posix

Ansible Collection for Posix
Python
152
star
15

community.digitalocean

This Ansible collection contains modules for assisting in the automation of the DigitalOcean cloud.
Python
141
star
16

ansible.netcommon

Ansible Network Collection for Common Code
Python
141
star
17

vmware.vmware_rest

Ansible Collection for VMWare (REST modules)
Python
126
star
18

community.grafana

Grafana Collection for Ansible
Python
123
star
19

community.network

Ansible Community Network Collection
Python
121
star
20

cisco.nxos

Ansible Network Collection for Cisco NXOS
Python
115
star
21

community.postgresql

Manage PostgreSQL with Ansible
Python
105
star
22

hetzner.hcloud

A collection to manage resources on Hetzner Cloud
Python
104
star
23

google.cloud

GCP Ansible Collection https://galaxy.ansible.com/google/cloud
Python
98
star
24

community.mysql

MySQL Ansible Collection
Python
96
star
25

community.crypto

The community.crypto collection for Ansible.
Python
96
star
26

community.routeros

Ansible modules for managing MikroTik RouterOS instances.
Python
95
star
27

collection_template

A GitHub Template repo to use as the basis for future repos
91
star
28

arista.eos

Ansible Network Collection for Arista EOS
Python
82
star
29

junipernetworks.junos

Ansible Network Collection for Juniper JunOS
Python
80
star
30

ibm_zos_core

Red Hat Ansible Certified Content for IBM Z
Python
76
star
31

community.sops

Simple and flexible tool for managing secrets
Python
74
star
32

ansible.utils

A collection of ansible utilities for the content creator.
Python
73
star
33

servicenow.itsm

Ansible Collection for ServiceNow ITSM
Python
71
star
34

community.hashi_vault

Ansible collection for managing and working with HashiCorp Vault.
Python
69
star
35

cloud.terraform

The collection automates the management and provisioning of infrastructure as code (IaC) using the Terraform CLI tool within Ansible playbooks and Execution Environment runtimes.
Python
67
star
36

cisco.iosxr

Ansible Network Collection for Cisco IOSXR
Python
65
star
37

community.libvirt

Manage libvirt with Ansible
Python
59
star
38

netapp.ontap

Ansible collection to support NetApp ONTAP configuration.
Python
50
star
39

netapp

Development area for Netapp collections
Python
49
star
40

cisco.asa

Ansible Security Collection for Cisco ASA
Python
49
star
41

dellemc.enterprise_sonic

Ansible Network Collection for Enterprise SONiC Distribution by Dell Technologies
Python
42
star
42

microsoft.ad

Ansible collection for Active Directory management
Python
39
star
43

dellemc.os10

Jinja
37
star
44

community.rabbitmq

Manage RabbitMQ with Ansible
Python
30
star
45

community.dns

Ansible modules and plugins for working with DNS
Python
25
star
46

community.cassandra

Cassandra Ansible Collection
Python
25
star
47

ibm.qradar

IBM QRadar Ansible Collection
Python
24
star
48

news-for-maintainers

Announcements of changes impacting collection contributors and maintainers
24
star
49

community.elastic

Python
24
star
50

ibm.spectrum_virtualize

IBM Spectrum Virtualize
21
star
51

community.proxysql

ProxySQL Ansible Collection
Python
20
star
52

community.healthchecksio

This Ansible collection contains modules for assisting in the automation of the Healthchecks.io monitoring service.
Python
18
star
53

community.hrobot

Hetzner Robot Collection
Python
17
star
54

community.cip

Ansible Collection to automate Programmable Logic Controllers over Common Industrial Protocol (CIP)
Python
17
star
55

ansible.network

Ansible Network Collection for network and IP utilities that are not specific to any platform or OS.
16
star
56

ansible.scm

An ansible collection for prescriptive retrieval and publish using git
Python
16
star
57

openvswitch.openvswitch

Ansible Network Collection for Open vSwitch
Python
15
star
58

ibm_zos_cics

The IBM z/OS CICS collection supports management of CICS resources and definitions in Ansible via the CMCI REST API provided by CICS.
Python
15
star
59

cloud.common

Common files for the Cloud collections
Python
14
star
60

frr.frr

Ansible Collection for Free Range Routing (FRR)
Python
13
star
61

amazon.cloud

Ansible Collection for Amazon AWS' Cloud Control API
Python
12
star
62

splunk.es

Ansible Collection for Splunk Enterprise
Python
11
star
63

community.internal_test_tools

Internal only, not for end users
Python
11
star
64

ansible-inclusion

Requests to include new collections into the ansible package
10
star
65

mellanox.onyx

onyx
Python
10
star
66

community.yang

Ansible Community Collection to support Yang in network devices.
Python
10
star
67

ansible.snmp

Python
10
star
68

ibm_zos_ims

IBM z/OS IMS Collection
Python
10
star
69

dellemc.os9

Jinja
9
star
70

vmware_rest_code_generator

Tooling ued to generate the vmware.vmware_rest collection
Python
9
star
71

dellemc.os6

Python
8
star
72

community.molecule

Ansible community.molecule is a very small collection that hosts filters used by molecule playbooks.
Python
8
star
73

community.ciscosmb

Ansible Galaxy module for Cisco SMB switches - SG300, SG500, SG350, SG550
Python
8
star
74

splunk.enterprise_security

Ansible Collection for Splunk Enterprise
7
star
75

community.sonic

Ansible Galaxy community module for SONiC NOS
Python
7
star
76

community.kubevirt

KubeVirt Collection of Ansible.
Python
7
star
77

ansible.security

Ansible Security Collection for security and are not specific to any security vendor.
7
star
78

pravic

An experimental project intended to explore how Ansible could be used to manage cloud-based resources in a more declarative way.
Python
7
star
79

community.google

Python
6
star
80

amazon_cloud_code_generator

Tooling used to generate the amazon.cloud collection
Python
6
star
81

community.sap

Python
6
star
82

logicmonitor

Repo to house LogicMonitor Collection
Python
6
star
83

vmware.vmware

Ansible VMWare Collection
Python
6
star
84

ansible.yang

Ansible Supported Collection to support YANG in network devices.
Python
5
star
85

community.fqcn_migration

5
star
86

community.clickhouse

Ansible Community ClickHouse Collection
Python
5
star
87

cloud.roles

Collection of roles to help get started using Ansible with public clouds
4
star
88

trendmicro.deepsec

Ansible Collection for managing TrendMicro DeepSecurity Endpoint Security solutions.
Python
4
star
89

community.vagrant

community.vagrant collection (to adopt the module from molecule-vagrant)
4
star
90

community.azure

Manage Azure with Ansible
4
star
91

netapp.storagegrid

Ansible collection to support NetApp StorageGrid configuration.
Python
3
star
92

ibm.ds8000

IBM DS8000
Python
3
star
93

netapp.aws

Ansible collection to support NetApp CVS configuration in AWS.
Python
3
star
94

checkpoint

Ansible Security Collection for Check Point devices
3
star
95

skydive

Ansible Collection for Skydive network / protocols analyzer
Python
3
star
96

consoledot.edgemanagement

PoC Ansible Collection for Red Hat Edge Fleet Manager
Python
3
star
97

netapp.cloudmanager

Ansible collection to support NetApp Cloud Manager configuration, including CVO deployments.
Python
3
star
98

pureport

An Ansible Collection for interacting with the Pureport Fabric ReST API
Python
3
star
99

ibm.cloud

Code and relative documentation for the IBM Cloud Collection
Python
3
star
100

community.fdo

Ansible Collection supporting FDO
Jinja
3
star