ravendb.ravendb.database module – Manage RavenDB databases
Note
This module is part of the ravendb.ravendb collection (version 1.0.4).
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 ravendb.ravendb.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: ravendb.ravendb.database.
New in ravendb.ravendb 1.0.0
Synopsis
Create or delete a RavenDB database, and optionally apply per-database settings.
Supports secured connections using client certificates and optional CA verification.
Check mode is supported to simulate creation, deletion, or settings changes without applying them.
Supports creating encrypted databases by assigning a secret key (generated or user-provided) and distributing it to all cluster nodes.
Supports fixed placement by specifying exact cluster node tags to host the database (topology members).
Supports applying per-database settings (
database_settings) and triggering a safe database reload so changes take effect.
Requirements
The below requirements are needed on the host that executes this module.
python >= 3.9
ravendb python client
ASP.NET Core Runtime
requests
Role ravendb.ravendb.ravendb_python_client_prerequisites must be installed before using this module.
Parameters
Parameter |
Comments |
|---|---|
Path to a trusted CA certificate file to verify the RavenDB server’s certificate. |
|
Path to a client certificate (PEM format) for secured communication. |
|
Name of the database. Must be a valid name containing only letters, numbers, dashes, and underscores. |
|
Dictionary of database-level settings to apply. Keys and values are normalized to strings and compared against current customized settings. When differences exist, the module updates settings and toggles the database state to reload them safely. Default: |
|
Create the database as encrypted. When Requires Choices:
|
|
Path to a file that contains the raw encryption key (plain text). Mutually exclusive with Used only when |
|
When Ignored if |
|
If Mutually exclusive with Used only when Choices:
|
|
Number of server nodes to replicate the database to. Must be a positive integer. Only used when creating a database. Required on creation; ignored for existing databases. |
|
Desired state of the database. If If If omitted ( If the database does not exist and Choices:
|
|
Optional list of cluster node tags to host this database (fixed placement). When provided, its length must equal Honored only on creation. If the database already exists, providing Default: |
|
URL of the RavenDB server. Must include the scheme (http or https), hostname, and port. |
Attributes
Attribute |
Support |
Description |
|---|---|---|
Support: full |
Can run in check_mode and return changed status prediction without modifying target. If not supported, the action will be skipped. |
Notes
Note
The role
ravendb.ravendb.ravendb_python_client_prerequisitesmust be applied before using this module.Requires the ASP.NET Core Runtime to be installed on the target system.
See Also
See also
- RavenDB documentation
Official RavenDB documentation
Examples
- name: Create a RavenDB database
ravendb.ravendb.database:
url: "http://{{ ansible_host }}:8080"
database_name: "my_database"
replication_factor: 3
state: present
- name: Create RF=2 database on specific nodes A and C (fixed placement)
ravendb.ravendb.database:
url: "http://{{ ansible_host }}:8080"
database_name: "placed_db"
replication_factor: 2
topology_members: ["A", "C"]
state: present
- name: Create an encrypted database with a generated key and save it locally (requires client cert)
become: true
ravendb.ravendb.database:
url: "https://{{ ansible_host }}:443"
database_name: "secure_db"
replication_factor: 1
certificate_path: "admin.client.combined.pem"
ca_cert_path: "ca_certificate.pem"
encrypted: true
generate_encryption_key: true
encryption_key_output_path: "/home/$USER/secure_db.key"
state: present
- name: Create an encrypted database using a pre-provisioned key file
ravendb.ravendb.database:
url: "https://{{ ansible_host }}:443"
database_name: "secure_db2"
replication_factor: 1
certificate_path: "admin.client.combined.pem"
ca_cert_path: "ca_certificate.pem"
encrypted: true
encryption_key: "/home/$USER/secure_db2.key"
state: present
- name: Update database settings (idempotent) – will not create database if absent (state omitted)
ravendb.ravendb.database:
url: "http://{{ ansible_host }}:8080"
database_name: "my_database"
database_settings:
Indexing.MapBatchSize: "64"
- name: Apply settings in check mode (no changes will be made)
ravendb.ravendb.database:
url: "http://{{ ansible_host }}:8080"
database_name: "my_database"
database_settings:
Indexing.MapBatchSize: "64"
check_mode: yes
- name: Delete a RavenDB database
ravendb.ravendb.database:
url: "http://{{ ansible_host }}:8080"
database_name: "my_database"
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
Indicates if any change was made (or would have been made in check mode). Returned: always Sample: |
|
Human-readable message describing the result or error. Returned: always Sample: |