Giter VIP home page Giter VIP logo

community.mongodb's Introduction

MongoDB Version and PyMongoDB Version Compatibility

  • This collection is tested against the most recent two MongoDB releases, currently 6.0.X and 7.0.X.
  • PyMongo - latest version supported only.
  • Please upgrade your PyMongo driver version if you encounter difficulties.

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
git clone  https://github.com/ansible-collections/community.crypto.git ./crypto
  • 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.

community.mongodb's People

Contributors

123blin avatar alterphp avatar alustenberg avatar andersson007 avatar ausias-armesto avatar beerfranz avatar ceefour avatar cognifloyd avatar dependabot[bot] avatar detobel36 avatar gundalow avatar jouir avatar julienorain avatar koxx009 avatar leospyke avatar manuelschmitzberger avatar manusa avatar marcosdiez avatar matthieu-eck avatar mikkolaj avatar nervo avatar panpomaly avatar psabhay avatar redat00 avatar rhysmeister avatar rndmh3ro avatar schurzi avatar tauffredou avatar tchandelle avatar ydixken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

community.mongodb's Issues

codecov no longer working

SUMMARY

codecov is broken for some reason. Probably need to regenerate the base report

ISSUE TYPE
  • Bug Report

MongoDB community pinboard

Github mongodb issues Github mongodb PRs MongoDB pinboard

We could collectively benefit from forming a Working Group related to MongoDB integration. We have quite some contributors and users that are interested in improving this integration.

So this issue is a call to potential interested parties (earlier and existing contributors to Ansible). The benefits of having a Working Group is that members of the Working Group can:

  • test, review and add shipits to existing MongoDB PRs
  • work collectively on a MongoDB roadmap
  • provide a single-point-of-contact for interested MongoDB contributors
  • collaborate on a MongoDB-specific Wiki
  • have a $team_mongodb in BOTMETA.yml for auto-notifying team members
  • implement auto-labeling MongoDB issues and PRs

mongodb_replicaset - Allow to be provided as dictionaries

SUMMARY
- name: Ensure replicaset rs0 exists
  mongodb_replicaset:
    login_host: localhost
    login_user: admin
    login_password: admin
    replica_set: rs0
    members:
    - "mongodb1:27017":
          priority: 1
    - "mongodb2:27017":
          priority: 0
    - "mongodb3:27017":
          priority: 0
  when: groups.mongod.index(inventory_hostname) == 0
```

The members list of dictionaries would be transformed into the following...

```
members: [
    { "_id": 0, "host": "mongodb1:27017", "priority": 1 },
    { "_id": 1, "host": "mongodb2:27017", "priority": 0 },
    { "_id": 1, "host": "mongodb3:27017", "priority": 0 },
]
```

We could allow any keys in the dictionary to future-proof it. "_id" value should be positional.

##### ISSUE TYPE
- Feature Idea

##### COMPONENT NAME

mongodb_replicaset

Rename repo to community.mongodb

SUMMARY

Hi,
To be more consistent with the other repos https://github.com/ansible-collections/ I'd like to rename this GitHub Repo to be community.mongodb

  • Old URLs for issues and PRs will still work
  • Old git URLs will work, though it will be good to update them locally
  • We will need to update the URLs in galaxy.yml

Are you happy with this?

ISSUE TYPE
  • Bug Report

Replica Set Members not validated or configured

SUMMARY

Replica Set Members not validated or configured.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

My best guess is that community.mongodb/plugins/modules/mongodb_replicaset.py is not using the members data to validate the config or to reconfigure the replica.

ANSIBLE VERSION
ansible 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/goferito/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0]
CONFIGURATION

OS / ENVIRONMENT

Ubuntu 20.04.1 LTS

STEPS TO REPRODUCE

Running the next task over a one-member initialized replica set, does not report any error, nor re-configures the replica.

    - name: Ensure replicaset rs0 exists
      mongodb_replicaset:
        login_host: localhost
        login_port: 10000
        replica_set: rs0
        members:
          - mongo1INT:10000
          - mongo2INT:10000
          - mongo3INT:10000
      validate: yes/no
EXPECTED RESULTS

If validate: yes, and the replica's config doesn't match, it should throw an error. If validate: no, it should reconfigure the replica?

ACTUAL RESULTS

Nothing happens. The task completes as [ok]. Nothing is changed. On the mongo server rs.config() or rs.status() still report just one member.

Check mongodb lookup plugin

SUMMARY

There were a few commits to the mongodb.py lookup plugin and tests recently. Check these have been included here.

  • Bug Report
COMPONENT NAME

mongodb.py

authenticate using x509 Membership Authentication

SUMMARY

For setting up a mongodb, being able to authenticate using the x509 Membership Authentication would be quite useful, as it would allow secure authentication before any user is configured.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

mongodb_common

ADDITIONAL INFORMATION

This feature could be used to configure a cluster from the first second with little preparation, in addition to that, the cluster could be set up without restarting any node, as authentication could be enabled at the first boot.

When implemented, the plugins could be used for doing something like this:

- name: create admin user
  command: |
    /usr/bin/mongo mongodb-host.test \
          --tls \
          --tlsCAFile /tmp/ca.crt \
          --tlsCertificateKeyFile=/tmp/tls.key \
          --authenticationMechanism MONGODB-X509 \
          --authenticationDatabase '$external' \
          --eval \
          '{{ lookup('template', 'templates/create-admin-user.js') }}'
  register: mongoout
  changed_when: "'{ \0ok\0 : 1 }' in mongoout.stdout"

Mongopy seems to support this.
The mongodb doc for x509 membership authentication.

SSL Support

SUMMARY

Implement ability to use SSL certs in all MongoDB modules. This has been discussed here...

ansible/ansible#66865

and there are also a couple of code contributions here...

ansible/ansible#52200 - Feb 2019
ansible/ansible#56911 - May 2019

If this is implemented it should be implemented in all modules

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

All MongoDB Modules

Set no_log for update_password in mongodb_user module

SUMMARY

Ansible spits out the following warning when we use the mongodb_user module...

[WARNING]: Module did not set no_log for update_password

Let's add no_log to this parameter. Not super important but prevents the unneeded nag.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

mongodb_user

Inclusion of community.mongodb in Ansible 2.10

This collection will be included in Ansible 2.10 because it contains modules and/or plugins that were included in Ansible 2.9. Please review:

DEADLINE: 2020-08-18

The latest version of the collection available on August 18 will be included in Ansible 2.10.0, except possibly newer versions which differ only in the patch level. (For details, see the roadmap). Please release version 1.0.0 of your collection by this date! If 1.0.0 does not exist, the same 0.x.y version will be used in all of Ansible 2.10 without updates, and your 1.x.y release will not be included until Ansible 2.11 (unless you request an exception at a community working group meeting and go through a demanding manual process to vouch for backwards compatibility . . . you want to avoid this!).

Follow semantic versioning rules

Your collection versioning must follow all semver rules. This means:

  • Patch level releases can only contain bugfixes;
  • Minor releases can contain new features, new modules and plugins, and bugfixes, but must not break backwards compatibility;
  • Major releases can break backwards compatibility.

Changelogs and Porting Guide

Your collection should provide data for the Ansible 2.10 changelog and porting guide. The changelog and porting guide are automatically generated from ansible-base, and from the changelogs of the included collections. All changes from the breaking_changes, major_changes, removed_features and deprecated_features sections will appear in both the changelog and the porting guide. You have two options for providing changelog fragments to include:

  1. If possible, use the antsibull-changelog tool, which uses the same changelog fragment as the ansible/ansible repository (see the documentation).
  2. If you cannot use antsibull-changelog, you can provide the changelog in a machine-readable format as changelogs/changelog.yaml inside your collection (see the documentation of changelogs/changelog.yaml format).

If you cannot contribute to the integrated Ansible changelog using one of these methods, please provide a link to your collection's changelog by creating an issue in https://github.com/ansible-community/ansible-build-data/. If you do not provide changelogs/changelog.yml or a link, users will not be able to find out what changed in your collection from the Ansible changelog and porting guide.

Make sure your collection passes the sanity tests

Run ansible-test sanity --docker -v in the collection with the latest ansible-base or stable-2.10 ansible/ansible checkout.

Keep informed

Be sure you're subscribed to:

Questions and Feedback

If you have questions or want to provide feedback, please see the Feedback section in the collection requirements.

(Internal link to keep track of issues: ansible-collections/overview#102)

Add reboot test to MongoDB roles

SUMMARY

Add a Testinfra tests where we reboot the node and check that the mongod/s service comes back up after reboot

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

roles/clusters

Test multiple versions of MongoDB

SUMMARY

If we can pass ansible variables into ansible-test we can override the version and run the tests using multiple versions of MongoDB. The last two releases should suffice.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

ansible-test / github workflow

documentation.yml workflow broken

SUMMARY

documentation.yml workflow broken. Modules pages are empty. Perhaps due to the introduction of fragments?

ISSUE TYPE
  • Bug Report

Please delete tag: refs/heads/master

SUMMARY

There is a bogus git tag that makes pushing to a fork difficult. I was trying to bring my fork's master up-to-date. When I push, I get:

error: dst refspec refs/heads/master matches more than one
error: failed to push some refs to '[email protected]:cognifloyd/community.mongodb.git'

I've deleted the refs/heads/master tag (yes, tag, not a branch) from my fork, but every time I git fetch --all from my upstream remote (this repo) to get any new release tags, it also re-adds the bad tag.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

git

HOW TO FIX

Someone with commit access to this repo, please (1) delete the tag locally, and then (2) delete the tag on github.

git tag -d refs/heads/master
git push origin :refs/tags/refs/heads/master

Tested with my fork.

Fix travis_run.sh script

SUMMARY

Script failed when there are no role modification in the script. We should handle this...

/home/travis/build/ansible-collections/mongodb
There are 32 files in this commit.
./travis_run.sh: line 37: role_list[@]: unbound variable
The command "./travis_run.sh" exited with 1.
```

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME

travis_run.sh

lookup_mongodb_ Update int tests to run on all OS's

SUMMARY

lookup_mongodb int tests only run on Ubuntu. Update these to run on all OS's.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

lookup_mongodb int tests

ADDITIONAL INFORMATION

Restriction is in tasks/main.yml

Add auto install of pymongo?

SUMMARY

The apt module auto-installs python-apt automatically if needed. Could/Should we do this in the MongoDB modules?

  • Should be implemented in all modules if taken on.
ISSUE TYPE
  • Feature Idea
COMPONENT NAME

All MongoDB modules

mongodb_info tests

SUMMARY

These tests should probably use the standard setup_mongodb process like the others.

ISSUE TYPE
  • Feature Idea

Create worklow to build and publish a collection

SUMMARY

It sould be possible to create a workflow that can build and deploy a collection to Ansible Galaxy. This could perhaps be triggered by a keyword in the commit message.

ISSUE TYPE
  • Feature Idea

mongodb_replicaset broken with mongodb 4.0.20

SUMMARY
ISSUE TYPE
  • Bug Report
COMPONENT NAME

mongodb_replicaset

ANSIBLE VERSION
rick@beryl /nvme/rick/dev/ansible/ansible $ ansible --version
ansible 2.9.12.post0
  config file = None
  configured module search path = ['/nvme/gentoo/rick/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /nvme/rick/dev/ansible/ansible/lib/ansible
  executable location = /nvme/rick/dev/ansible/ansible/bin/ansible
  python version = 3.7.8 (default, Jul 25 2020, 16:21:40) [GCC 9.3.0]
CONFIGURATION

N/A

OS / ENVIRONMENT

RHEL-ish

STEPS TO REPRODUCE

RHEL tests are currently failing in ansible/ansible because mongodb released 4.0.20 in their yum repo which has a change that breaks mongodb_replicaset.

Test result:
https://app.shippable.com/github/ansible/ansible/runs/172750/53/console

I dug into this a bit:

The mongodb_replicaset module runs a listDatabases query to determine if it needs to auth or not.

Basically, in 4.0.19, this query works:

> db.adminCommand({ listDatabases: 1.0, $readPreference: { mode: "primaryPreferred" }})
{
	"databases" : [
		{
			"name" : "local",
			"sizeOnDisk" : 180224,
			"empty" : false
		}
	],
	"totalSize" : 180224,
	"ok" : 1,
	"operationTime" : Timestamp(0, 0),
	"$clusterTime" : {
		"clusterTime" : Timestamp(0, 0),
		"signature" : {
			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
			"keyId" : NumberLong(0)
		}
	}
}

In 4.0.20, it fails:

> db.adminCommand({ listDatabases: 1.0, $readPreference: { mode: "primaryPreferred" }})
{
	"operationTime" : Timestamp(0, 0),
	"ok" : 0,
	"errmsg" : "node is not in primary or recovering state",
	"code" : 13436,
	"codeName" : "NotMasterOrSecondary",
	"$clusterTime" : {
		"clusterTime" : Timestamp(0, 0),
		"signature" : {
			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
			"keyId" : NumberLong(0)
		}
	}
}

It fails in both without $readPreference - which makes me think that 4.0.20 stopped obeying that option for some reason. I stopped my digging there, my next step would probably be to bisect mongodb and see what commit broke this, but I haven't.

We are disabling the test in ansible/ansible for now. Ideally if you're able to look into this and work around it, a backport to 2.9 would be great.

Dynamically populate module test list in CI

SUMMARY

Currently we manually specify the lit of modules we test in CI with a lit of strings. It would be good to populate this dynamically so we don't have to manage it. Need to remember cache(lookup plugins also)

Maybe something like this will work?

- name: Get pip cache dir
  id: pip-cache
  run: |
    echo "::set-output name=dir::$(pip cache dir)"

https://github.com/actions/cache/blob/main/examples.md#python---pip

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

CI workflows

Issues with coverage.sh script

SUMMARY

Couple of issues noted from script output...

Many reports. Old ones not purged? Should they be?

+ ./tests/output/coverage/integration=mongodb_status=docker-default=python-3.6=coverage.33df63ea82fd.21336.617885 bytes=74
+ ./tests/output/coverage/integration=mongodb_shard=docker-default=python-3.6=coverage.33df63ea82fd.16556.359546 bytes=74
+ ./tests/output/coverage/integration=mongodb_parameter=docker-default=python-3.6=coverage.33df63ea82fd.2458.500220 bytes=74
+ ./tests/output/coverage/integration=mongodb_status=docker-default=python-3.6=coverage.33df63ea82fd.20412.121263 bytes=74
+ ./tests/output/coverage/integration=mongodb_shard=docker-default=python-3.6=coverage.33df63ea82fd.14135.428499 bytes=74
+ ./tests/output/coverage/integration=mongodb_replicaset=docker-default=python-3.6=coverage.33df63ea82fd.7543.442920 bytes=74
+ ./tests/output/coverage/integration=mongodb_replicaset=docker-default=python-3.6=coverage.33df63ea82fd.6263.373808 bytes=74
+ ./tests/output/coverage/integration=mongodb_parameter=docker-default=python-3.6=coverage.33df63ea82fd.3193.880675 bytes=268
+ ./tests/output/coverage/integration=mongodb_replicaset=docker-default=python-3.6=coverage.33df63ea82fd.4286.009747 bytes=74
+ ./tests/output/coverage/integration=mongodb_status=docker-default=python-3.6=coverage.33df63ea82fd.18989.000571 bytes=74
+ ./tests/output/coverage/integration=mongodb_shard=docker-default=python-3.6=coverage.33df63ea82fd.15595.861734 bytes=74
+ ./tests/output/coverage/integration=mongodb_shard=docker-default=python-3.6=coverage.33df63ea82fd.16671.557285 bytes=74

Other issues...

+ -X coveragepy -X gcov -X fix -X search -X xcode -K
tests/coverage.sh: line 27: -X: command not found
+ echo 'Failed to upload code coverage report to codecov.io: tests/output/coverage/coverage=*.xml'
Failed to upload code coverage report to codecov.io: tests/output/coverage/coverage=*.xml

ISSUE TYPE
  • Bug Report
COMPONENT NAME

coverage.sh

MongoDB cache plugin fails to run after first run if CACHE_PLUGIN_TIMEOUT=0

SUMMARY

MongoDB cache fails to run if cache exists with no TTL

ISSUE TYPE
  • Bug Report
COMPONENT NAME

MongoDB cache

ANSIBLE VERSION
ansible 2.9.11
  config file = /home/{user}/.ansible.cfg
  configured module search path = ['/home/{user}/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Dec  5 2019, 15:45:45) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]

CONFIGURATION
ANSIBLE_SSH_ARGS(/home/{user}/.ansible.cfg) = -o ControlMaster=auto -o ControlPersist=90s
ANSIBLE_SSH_CONTROL_PATH(/home/{user}/.ansible.cfg) = %(directory)s/%%h-%%p-%%r
CACHE_PLUGIN(/home/{user}/.ansible.cfg) = mongodb
CACHE_PLUGIN_CONNECTION(/home/{user}/.ansible.cfg) = mongodb://{user}:{password}@127.0.0.1:27017/
CACHE_PLUGIN_PREFIX(/home/{user}/.ansible.cfg) = fact_
CACHE_PLUGIN_TIMEOUT(/home/{user}/.ansible.cfg) = 0
DEFAULT_FORKS(/home/{user}/.ansible.cfg) = 100
DEFAULT_GATHERING(/home/{user}/.ansible.cfg) = implicit
DEFAULT_GATHER_SUBSET(/home/{user}/.ansible.cfg) = ['all']
DEFAULT_LOG_PATH(/home/{user}/.ansible.cfg) = /var/log/ansible.log
DEFAULT_NO_TARGET_SYSLOG(/home/{user}/.ansible.cfg) = True
DEFAULT_POLL_INTERVAL(/home/{user}/.ansible.cfg) = 15
DEFAULT_SCP_IF_SSH(/home/{user}/.ansible.cfg) = True
DEFAULT_TIMEOUT(/home/{user}/.ansible.cfg) = 5
DEFAULT_VAULT_PASSWORD_FILE(/home/{user}/.ansible.cfg) = /home/{user}/ans.txt
HOST_KEY_CHECKING(/home/{user}/.ansible.cfg) = False
RETRY_FILES_ENABLED(/home/{user}/.ansible.cfg) = False

OS / ENVIRONMENT

OS: RHEL 8.2
Kernel: 4.18.0-193.14.3.el8_2.x86_64
Mongo Ver: 4.4.0

STEPS TO REPRODUCE

Configure mongodb cache plugin to have CACHE_PLUGIN_TIMEOUT=0. Run any playbook that uses cache twice. Do not delete the cache between runs.

EXPECTED RESULTS

Run playbook and cache in mongodb

ACTUAL RESULTS

Fails on second run with the following error:

 ERROR! Unexpected Exception, this is probably a bug: index not found with name [ttl], full error: {'ok': 0.0, 'errmsg': 'index not found with name [ttl]', 'code': 27, 'codeName': 'IndexNotFound'}

mongodb_shell: Add ability to pass arbitrary cmd line options

SUMMARY

The mongodb_shell module only supports a limited number of cmd line options. Add the ability to add arbitrary cmd line options so the user is not limited in any way. Hint: Could be implemented in a similar way to connection_options

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

mongodb_shell & int tests

Add mongodb_version var to mongodb_install role

SUMMARY

Add ability to install specific minor version of mongodb-org package.

ISSUE TYPE
  • Feature Idea
    Add variable to be able to set specific minor version.
COMPONENT NAME

mongodb_install role

mongodb_shard does not recognize mongos with custom process name

SUMMARY

When adding a shard the module checks for the connected server being a mongos by comparing the process name returned from the serverStatus to 'mongos'. That process name can be changed by using a custom name for the mongos binary (different versions on the same server or other reasons). Therefor the module fails in that case complaining that the process running on the specified host/port is not a mongos.

See https://github.com/ansible-collections/community.mongodb/blob/master/plugins/modules/mongodb_shard.py#L478

ISSUE TYPE
  • Bug Report
COMPONENT NAME

mongodb_shard

ANSIBLE VERSION
ansible 2.8.11
  config file = /ansible/playbooks/de/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.7.5 (default, Oct 17 2019, 12:25:15) [GCC 8.3.0]
CONFIGURATION
ANSIBLE_PIPELINING(/ansible/playbooks/de/ansible.cfg) = True
ANSIBLE_SSH_ARGS(/ansible/playbooks/de/ansible.cfg) = -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o PreferredAuthentications=password,publickey
DEFAULT_ACTION_PLUGIN_PATH(env: ANSIBLE_ACTION_PLUGINS) = ['/ansible/plugins/action_plugins']
DEFAULT_FORKS(/ansible/playbooks/de/ansible.cfg) = 20
DEFAULT_LOG_PATH(/ansible/playbooks/de/ansible.cfg) = /ansible/playbooks/de/ansible.log
DEFAULT_TIMEOUT(/ansible/playbooks/de/ansible.cfg) = 30
DEFAULT_VAULT_IDENTITY_LIST(env: ANSIBLE_VAULT_IDENTITY_LIST) = ['production-de@/tmp/.vault-password-production-de', 'staging-de@/tmp/.vault-password-staging-de', 'test-de@/tmp/.vault-password-test-de']
HOST_KEY_CHECKING(/ansible/playbooks/de/ansible.cfg) = False
OS / ENVIRONMENT

Debian 10.2

STEPS TO REPRODUCE

Rename the mongos binary to some random name or create a symlink with another name (like custom-mongos-1) and use that for starting the mongos service. The server status of the mongos should show the custom binary in the process field:

mongos> db.serverStatus()
{
	"host" : "mongos-1.yourdomain.net:58350",
	"version" : "3.4.24",
	"process" : "custom-mongos-1",
        ...
}

Now try adding a shard using the mongodb_shard module.

- name: Add all shards to the cluster
  mongodb_shard:
    login_host: "{{ item.0.mongos_login_host }}"
    login_port: "{{ item.0.mongos_login_port|int }}"
    shard: "{{ item.0.replicaset }}/{{ item.1 }}"
    state: present
  loop: "{{ mongodb_shards|subelements('members') }}"
  when: item.0.type == 'shard'
  run_once: yes
EXPECTED RESULTS

Shard is added to MongoDB cluster

ACTUAL RESULTS
failed: [shard1-1.yourdomain.net] (item=[{'replicaset': 'shard1', 'type': 'shard', 'login_host': 'shard1-1.yourdomain.net', 'login_port': 28351, 'mongos_login_host': 'mongos-1.yourdomain.net', 'mongos_login_port': 58350, 'members': ['shard1-1.yourdomain.net:28351', 'shard1-2.yourdomain.net:28351', 'shard1-3.yourdomain.net:28351']}, 'shard1-3.yourdomain.net:28351']) => {"ansible_loop_var": "item", "changed": false, "item": [{"login_host": "shard1-1.yourdomain.net", "login_port": 28351, "members": ["shard1-1.yourdomain.net:28351", "shard1-2.yourdomain.net:28351", "shard1-3.yourdomain.net:28351"], "mongos_login_host": "mongos-1.yourdomain.net", "mongos_login_port": 58350, "replicaset": "shard1", "type": "shard"}, "shard1-3.yourdomain.net:28351"], "msg": "Process running on mongos-1.yourdomain.net:58350 is not a mongos"}

Migrated issue from ansible/ansible#69256.

Add int tests for x509 membership auth

SUMMARY

Add integration tests for the auth feature discussed in #177.

The pymongo based module all use the same code, so if one work they all should, still probably not a bad idea to add tests for multiple modules where reasonable. The k8 env in #179 can be used. Rhys to add a few notes to the README.md

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

integration tests

Namespace references in galaxy.yml

SUMMARY

Incorrect references to namespace/project? Or is this simply waiting for further setup? Same issue in the community.cassandra namespace https://github.com/ansible-collections/cassandra/blob/master/galaxy.yml

galaxy.yml contains references to community.mongo, i.e.

homepage: https://github.com/ansible-collections/community.mongo

Should this not be...

homepage: https://github.com/ansible-collections/mongodb?

There are references elsewhere to this namespace.project form. These links 404.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

galaxy.yml

mongodb_user update_password not working as intented

SUMMARY

It seems the update_password does not compare the current password in the database and update the password on every run even if it's the same one. According to the doc: always(which is the default) will update passwords if they differ

ISSUE TYPE
  • Bug Report
COMPONENT NAME

mongodb_user

ANSIBLE VERSION
ansible 2.9.10
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/var/lib/rundeck/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609]
CONFIGURATION
DEFAULT_FORKS(/etc/ansible/ansible.cfg) = 25
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = [u'/etc/ansible/inventories']
DEFAULT_REMOTE_USER(/etc/ansible/ansible.cfg) = rundeck
DEFAULT_VAULT_PASSWORD_FILE(/etc/ansible/ansible.cfg) = /var/lib/rundeck/vault_pass.txt
INTERPRETER_PYTHON(/etc/ansible/ansible.cfg) = /usr/bin/python3
OS / ENVIRONMENT

Target OS:

Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic
MongoDB shell version v4.2.8
git version: 43d25964249164d76d5e04dd6cf38f6111e21f5f
OpenSSL version: OpenSSL 1.1.1  11 Sep 2018
allocator: tcmalloc
modules: none
build environment:
    distmod: ubuntu1804
    distarch: x86_64
    target_arch: x86_64
STEPS TO REPRODUCE

Use the following code:

- name: Create Mongodb users
  mongodb_user:
    database: admin
    name: "mongo"
    password: "changeme"
    roles: readWriteAnyDatabase
    state: present

and watch the password being overwritten every run with:

mongo
use admin
db.getUsers({showCredentials: true})
EXPECTED RESULTS

Return 'Changed' the first time the user is created. Subsequent runs should not overwrite the password if it's the same thing already

ACTUAL RESULTS

Password is changed on every run which result in always a 'Changed'

changed: [test] => {
    "changed": true,
    "invocation": {
        "module_args": {
            "database": "admin",
            "login_database": null,
            "login_host": "localhost",
            "login_password": null,
            "login_port": "27017",
            "login_user": null,
            "name": "mongo",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "replica_set": null,
            "roles": [
                "readWriteAnyDatabase"
            ],
            "ssl": false,
            "ssl_cert_reqs": "CERT_REQUIRED",
            "state": "present",
            "update_password": "always"
        }
    },
    "user": "mongo"
}

Remove version specific stuff from integration tests

SUMMARY

The integration tests (at least for mongodb_shard/replicaset) contain version specific checks that we were forced to do. We basically repeat the same tasks with version 3/4. Since we only test only the two previous releases (currently 4.0 and 4.2) we should remove the version check stuff.

ISSUE TYPE
  • Bug Report

Add integration tests for ssl options

SUMMARY

Add integration tests for ssl options. All modules now have corresponding options for the pymongo ssl connection options. These should be tested against ssl enabled mongod/s instances.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

All modules.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.