ansible / ansible.builtin / v2.9.17 / module / azure_rm_cosmosdbaccount Manage Azure Database Account instance | "added in version" 2.8 of ansible.builtin" Authors: Zim Kalinowski (@zikalino) preview | supported by communityansible.builtin.azure_rm_cosmosdbaccount (v2.9.17) — module
pip
Install with pip install ansible==2.9.17
Create, update and delete instance of Azure Database Account.
- name: Create Cosmos DB Account - min azure_rm_cosmosdbaccount: resource_group: myResourceGroup name: myDatabaseAccount location: westus geo_rep_locations: - name: southcentralus failover_priority: 0 database_account_offer_type: Standard
- name: Create Cosmos DB Account - max azure_rm_cosmosdbaccount: resource_group: myResourceGroup name: myDatabaseAccount location: westus kind: mongo_db geo_rep_locations: - name: southcentralus failover_priority: 0 database_account_offer_type: Standard ip_range_filter: 10.10.10.10 enable_multiple_write_locations: yes virtual_network_rules: - subnet: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVi rtualNetwork/subnets/mySubnet" consistency_policy: default_consistency_level: bounded_staleness max_staleness_prefix: 10 max_interval_in_seconds: 1000
kind: choices: - global_document_db - mongo_db - parse description: - Indicates the type of database account. This can only be set at database account creation. name: description: - Cosmos DB database account name. required: true tags: description: - Dictionary of string:string pairs to assign as metadata to the object. - Metadata tags on the object will be updated with any provided values. - To remove tags set append_tags option to false. type: dict state: choices: - absent - present default: present description: - Assert the state of the Database Account. - Use C(present) to create or update an Database Account and C(absent) to delete it. secret: description: - Azure client secret. Use when authenticating with a Service Principal. type: str tenant: description: - Azure tenant ID. Use when authenticating with a Service Principal. type: str ad_user: description: - Active Directory username. Use when authenticating with an Active Directory user rather than service principal. type: str profile: description: - Security profile found in ~/.azure/credentials file. type: str location: description: - The location of the resource group to which the resource belongs. - Required when I(state=present). password: description: - Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. type: str client_id: description: - Azure client ID. Use when authenticating with a Service Principal. type: str api_profile: default: latest description: - Selects an API profile to use when communicating with Azure services. Default value of C(latest) is appropriate for public clouds; future values will allow use with Azure Stack. type: str version_added: 0.0.1 version_added_collection: azure.azcollection append_tags: default: true description: - Use to control if tags field is canonical or just appends to existing tags. - When canonical, any tags not found in the tags parameter will be removed from the object's metadata. type: bool auth_source: choices: - auto - cli - credential_file - env - msi default: auto description: - Controls the source of the credentials to use for authentication. - Can also be set via the C(ANSIBLE_AZURE_AUTH_SOURCE) environment variable. - When set to C(auto) (the default) the precedence is module parameters -> C(env) -> C(credential_file) -> C(cli). - When set to C(env), the credentials will be read from the environment variables - When set to C(credential_file), it will read the profile from C(~/.azure/credentials). - When set to C(cli), the credentials will be sources from the Azure CLI profile. C(subscription_id) or the environment variable C(AZURE_SUBSCRIPTION_ID) can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. - When set to C(msi), the host machine must be an azure resource with an enabled MSI extension. C(subscription_id) or the environment variable C(AZURE_SUBSCRIPTION_ID) can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. - The C(msi) was added in Ansible 2.6. type: str version_added: 0.0.1 version_added_collection: azure.azcollection enable_table: description: - Enable Table. type: bool enable_gremlin: description: - Enable Gremlin. type: bool resource_group: description: - Name of an Azure resource group. required: true ip_range_filter: description: - Cosmos DB Firewall support. This value specifies the set of IP addresses or IP address ranges. - In CIDR form to be included as the allowed list of client IPs for a given database account. - IP addresses/ranges must be comma separated and must not contain any spaces. subscription_id: description: - Your Azure subscription Id. type: str enable_cassandra: description: - Enable Cassandra. type: bool cloud_environment: default: AzureCloud description: - For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, C(AzureChinaCloud), C(AzureUSGovernment)), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the C(AZURE_CLOUD_ENVIRONMENT) environment variable. type: str version_added: 0.0.1 version_added_collection: azure.azcollection geo_rep_locations: description: - An array that contains the georeplication locations enabled for the Cosmos DB account. - Required when I(state=present). suboptions: failover_priority: description: - The failover priority of the region. A failover priority of 0 indicates a write region. - The maximum value for a failover priority = (total number of regions - 1). - Failover priority values must be unique for each of the regions in which the database account exists. type: int name: description: - The name of the region. type: list adfs_authority_url: description: - Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. type: str version_added: 0.0.1 version_added_collection: azure.azcollection consistency_policy: description: - The consistency policy for the Cosmos DB account. suboptions: default_consistency_level: choices: - eventual - session - bounded_staleness - strong - consistent_prefix description: - The default consistency level and configuration settings of the Cosmos DB account. - Required when I(state=present). max_interval_in_seconds: description: - When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. - Accepted range for this value is 5 - 86400. Required when I(default_consistency_policy=bounded_staleness). type: int max_staleness_prefix: description: - When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. - Accepted range for this value is 1 - 2,147,483,647. Required when I(default_consistency_policy=bounded_staleness). type: int cert_validation_mode: choices: - ignore - validate description: - Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing C(ignore). Can also be set via credential file profile or the C(AZURE_CERT_VALIDATION) environment variable. type: str version_added: 0.0.1 version_added_collection: azure.azcollection virtual_network_rules: description: - List of Virtual Network ACL rules configured for the Cosmos DB account. suboptions: ignore_missing_vnet_service_endpoint: description: - Create Cosmos DB account without existing virtual network service endpoint. type: bool subnet: description: - It can be a string containing resource id of a subnet. - It can be a dictionary containing 'resource_group', 'virtual_network_name' and 'subnet_name' type: list enable_automatic_failover: description: - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. - Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. type: bool database_account_offer_type: description: - Database account offer type, for example I(Standard) - Required when I(state=present). enable_multiple_write_locations: description: - Enables the account to write in multiple locations type: bool is_virtual_network_filter_enabled: description: - Flag to indicate whether to enable/disable Virtual Network ACL rules. type: bool
id: description: - The unique resource identifier of the database account. returned: always sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DocumentDB/databaseAccounts/myData baseAccount type: str