azure.azcollection.azure_rm_cosmosdbaccount (2.3.0) — module

Manage Azure Database Account instance

| "added in version" 0.1.2 of azure.azcollection"

Authors: Zim Kalinowski (@zikalino)

Install collection

Install with ansible-galaxy collection install azure.azcollection:==2.3.0


Add to requirements.yml

  collections:
    - name: azure.azcollection
      version: 2.3.0

Description

Create, update and delete instance of Azure Database Account.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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_rules:
      - 10.10.10.10
    enable_multiple_write_locations: true
    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

Inputs

    
kind:
    choices:
    - global_document_db
    - mongo_db
    - parse
    description:
    - Indicates the type of database account. This can only be set at database account
      creation.
    type: str

name:
    description:
    - Cosmos DB database account name.
    required: true
    type: str

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.
    - Currently, Azure DNS zones and Traffic Manager services also don't allow the use
      of spaces in the tag.
    - Azure Front Door doesn't support the use of
    - Azure Automation and Azure CDN only support 15 tags on resources.
    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.
    type: str

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

ip_rules:
    description:
    - The IP addresses or IP address ranges in CIDR form to be included as the allowed
      list of client IPs.
    elements: str
    type: list
    version_added: 1.10.0
    version_added_collection: azure.azcollection

location:
    description:
    - The location of the resource group to which the resource belongs.
    - Required when I(state=present).
    type: str

log_mode:
    description:
    - Parent argument.
    type: str

log_path:
    description:
    - Parent argument.
    type: str

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 or Managed Identity
      (msi).
    - Can also be set via the C(AZURE_CLIENT_ID) environment variable.
    type: str

thumbprint:
    description:
    - The thumbprint of the private key specified in I(x509_certificate_path).
    - Use when authenticating with a Service Principal.
    - Required if I(x509_certificate_path) is defined.
    type: str
    version_added: 1.14.0
    version_added_collection: azure.azcollection

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

mongo_version:
    description:
    - Server version for the MongoDB account, such as c(3.2) or c(4.0).
    - Only used when c(kind) = i(mongo_db).
    type: str
    version_added: 1.10.0
    version_added_collection: azure.azcollection

enable_gremlin:
    description:
    - Enable Gremlin.
    type: bool

resource_group:
    description:
    - Name of an Azure resource group.
    required: true
    type: str

ip_range_filter:
    description:
    - (deprecated) 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.
    - This value has been deprecated, and will be removed in a later version. Use I(ip_rules)
      instead.
    type: str

subscription_id:
    description:
    - Your Azure subscription Id.
    type: str

enable_cassandra:
    description:
    - Enable Cassandra.
    type: bool

enable_free_tier:
    default: false
    description:
    - If enabled the account is free-tier.
    type: bool
    version_added: 1.10.0
    version_added_collection: azure.azcollection

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).
    elements: dict
    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.
        required: true
        type: int
      name:
        description:
        - The name of the region.
        required: true
        type: str
    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).
        type: str
      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
    type: dict

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

public_network_access:
    choices:
    - Enabled
    - Disabled
    default: Enabled
    description:
    - Enables or disables public network access to server.
    type: str
    version_added: 1.10.0
    version_added_collection: azure.azcollection

virtual_network_rules:
    description:
    - List of Virtual Network ACL rules configured for the Cosmos DB account.
    elements: dict
    suboptions:
      ignore_missing_v_net_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'
        required: true
        type: raw
    type: list

x509_certificate_path:
    description:
    - Path to the X509 certificate used to create the service principal in PEM format.
    - The certificate must be appended to the private key.
    - Use when authenticating with a Service Principal.
    type: path
    version_added: 1.14.0
    version_added_collection: azure.azcollection

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

disable_instance_discovery:
    default: false
    description:
    - Determines whether or not instance discovery is performed when attempting to authenticate.
      Setting this to true will completely disable both instance discovery and authority
      validation. This functionality is intended for use in scenarios where the metadata
      endpoint cannot be reached such as in private clouds or Azure Stack. The process
      of instance discovery entails retrieving authority metadata from https://login.microsoft.com/
      to validate the authority. By setting this to **True**, the validation of the authority
      is disabled. As a result, it is crucial to ensure that the configured authority
      host is valid and trustworthy.
    - Set via credential file profile or the C(AZURE_DISABLE_INSTANCE_DISCOVERY) environment
      variable.
    type: bool
    version_added: 2.3.0
    version_added_collection: azure.azcollection

database_account_offer_type:
    description:
    - Database account offer type, for example I(Standard)
    - Required when I(state=present).
    type: str

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

Outputs

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

See also