community.mongodb.mongodb_atlas_org_invite module – Manage Atlas organization user invitations
Note
This module is part of the community.mongodb collection (version 1.8.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.mongodb.
To use it in a playbook, specify: community.mongodb.mongodb_atlas_org_invite.
Synopsis
Invite users to a MongoDB Atlas organization with specified org and project roles.
If the user already exists in the org, the module reports no change (idempotent).
If a pending invite for the user already exists, the module reports no change.
Uses OAuth2 client_credentials (Service Account) for authentication.
Parameters
Parameter |
Comments |
|---|---|
Atlas API private key. Alternative to |
|
Atlas API public key. Alternative to |
|
Optional list of project-level role assignments. Default: |
|
Atlas project ID. |
|
List of project-level roles (e.g. GROUP_READ_ONLY, GROUP_DATA_ACCESS_READ_ONLY). |
|
Unique identifier of the Atlas organization. |
|
List of org-level roles to assign (e.g. ORG_OWNER, ORG_MEMBER, ORG_READ_ONLY). |
|
MongoDB Atlas Service Account client ID (OAuth2). Mutually exclusive with |
|
MongoDB Atlas Service Account client secret (OAuth2). Mutually exclusive with |
|
Choices:
|
|
Email address of the user to invite. |
Examples
- name: Invite user as org owner
community.mongodb.mongodb_atlas_org_invite:
service_account_id: "mdb_sa_id_xxxx"
service_account_secret: "mdb_sa_sk_xxxx"
org_id: "694ec9ddbaecce170ffe8b62"
username: "newuser@d360.com"
roles:
- ORG_OWNER
- name: Invite user with org and project roles
community.mongodb.mongodb_atlas_org_invite:
service_account_id: "mdb_sa_id_xxxx"
service_account_secret: "mdb_sa_sk_xxxx"
org_id: "694ec9ddbaecce170ffe8b62"
username: "analyst@d360.com"
roles:
- ORG_MEMBER
group_role_assignments:
- group_id: "6991db0a32bf1b56dbb63d62"
roles:
- GROUP_READ_ONLY
- name: Revoke pending invitation
community.mongodb.mongodb_atlas_org_invite:
service_account_id: "mdb_sa_id_xxxx"
service_account_secret: "mdb_sa_sk_xxxx"
org_id: "694ec9ddbaecce170ffe8b62"
username: "newuser@d360.com"
roles: []
state: absent