How to create, manage, etc projects in Atlas using Ansible

Hi all, we would like to create a playbook to automate some tasks, like create projects, ApiKeys, roles etc using Ansible, by the moment i have not found specific info about how to connect an Atlas Org or project from ansible, is there a way to do it?, thansk for your help

1 Like

Hi Reply to myself, next workd fine, :smiley:

  • name: Create Project in Atlas
    uri:
    url: β€œhttps://cloud.mongodb.com/api/atlas/v1.0/groups?projectOwnerId={{ UAID.msg }}”
    user: β€œ{{ atlas_public_key }}”
    password: β€œ{{ atlas_private_key }}”
    method: POST
    body: β€˜{ β€œname”: β€œ{{name projeect}}”, β€œorgId”: β€œ{{ atlas_OID }}” }’
    force_basic_auth: no
    status_code: [201, 409]
    body_format: json
2 Likes

There are some modules for mongodb but nothing specific for Atlas. So yes, your using uri or writing your own module.

I don’t think there are endpoints for everything you’re wanting to do but there is quite a lot that is useful in the API.

1 Like