azure.azcollection.azure_rm_postgresqlflexibleserver (2.3.0) — module

Manage PostgreSQL Flexible Server instance

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

Authors: xuzhang3 (@xuzhang3), Fred-sun (@Fred-sun)

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 PostgreSQL Flexible Server.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create (or update) PostgreSQL Flexible Server
  azure_rm_postgresqlflexibleserver:
    resource_group: myResourceGroup
    name: testserver
    sku:
      name: Standard_B1ms
      tier: Burstable
    administrator_login: azureuser
    administrator_login_password: Fred@0329
    version: 12
    storage:
      storage_size_gb: 128
    fully_qualified_domain_name: st-private-dns-zone.postgres.database.azure.com
    backup:
      backup_retention_days: 7
      geo_redundant_backup: Disabled
    maintenance_window:
      custom_window: Enabled
      start_hour: 8
      start_minute: 0
      day_of_week: 0
    point_in_time_utc: 2023-05-31T00:28:17.7279547+00:00
    availability_zone: 1
    create_mode: Default
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete PostgreSQL Flexible Server
  azure_rm_postgresqlflexibleserver:
    resource_group: myResourceGroup
    name: testserver
    state: absent

Inputs

    
sku:
    description:
    - The SKU (pricing tier) of the server.
    suboptions:
      name:
        description:
        - The name of the sku, typically, tier + family + cores, such as Standard_D4s_v3.
        required: true
        type: str
      tier:
        choices:
        - Burstable
        - GeneralPurpose
        - MemoryOptimized
        description:
        - The tier of the particular
        required: true
        type: str
    type: dict

name:
    description:
    - The name of the flexible server.
    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:
    - present
    - absent
    default: present
    description:
    - Assert the state of the PostgreSQL Flexible server.
    - Use C(present) to create or update a server and C(absent) to delete it.
    type: str

backup:
    description:
    - Backup properties of a server.
    suboptions:
      backup_retention_days:
        description:
        - Backup retention days for the server.
        type: int
      geo_redundant_backup:
        choices:
        - Enabled
        - Disabled
        description:
        - A value indicating whether Geo-Redundant backup is enabled on the server.
        type: str
    type: dict

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

is_stop:
    default: false
    description:
    - Whether to stop the Post gresql server.
    type: bool

network:
    description:
    - Network properties of a server.
    suboptions:
      delegated_subnet_resource_id:
        description:
        - Delegated subnet arm resource id.
        type: str
      private_dns_zone_arm_resource_id:
        description:
        - Private dns zone arm resource id.
        type: str
      public_network_access:
        choices:
        - Enabled
        - Disabled
        description:
        - Public network access is enabled or not.
        type: str
    type: dict

profile:
    description:
    - Security profile found in ~/.azure/credentials file.
    type: str

storage:
    description:
    - Storage properties of a server.
    suboptions:
      storage_size_gb:
        description:
        - The storage size for the server.
        type: int
    type: dict

version:
    choices:
    - '11'
    - '12'
    - '13'
    description:
    - PostgreSQL Server version.
    type: str

is_start:
    default: false
    description:
    - Whether to start the Post gresql server.
    type: bool

location:
    description:
    - Resource location. If not set, location from the resource group will be used as
      default.
    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

is_restart:
    default: false
    description:
    - Whether to restart the Post gresql server.
    type: bool

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

create_mode:
    choices:
    - Default
    - Create
    - Update
    - PointInTimeRestore
    description:
    - The mode to create a new PostgreSQL server.
    type: str

resource_group:
    description:
    - The name of the resource group that contains the resource.
    - You can obtain this value from the Azure Resource Manager API or the portal.
    required: true
    type: str

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

availability_zone:
    description:
    - Availability zone information of the server
    type: str

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

high_availability:
    description:
    - High availability properties of a server.
    suboptions:
      mode:
        choices:
        - Disabled
        - ZoneRedundant
        description:
        - The HA mode for the server.
        type: str
      standby_availability_zone:
        description:
        - Availability zone information of the standby.
        type: str
    type: dict

point_in_time_utc:
    description:
    - Restore point creation time (ISO8601 format), specifying the time to restore from.
    - It's required when I(create_mode=PointInTimeRestore).
    type: str

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

maintenance_window:
    description:
    - Maintenance window properties of a server.
    suboptions:
      custom_window:
        description:
        - Indicates whether custom window is enabled or disabled.
        type: str
      day_of_week:
        description:
        - Day of week for maintenance window.
        type: int
      start_hour:
        description:
        - Start hour for maintenance window.
        type: int
      start_minute:
        description:
        - Start minute for maintenance window.
        type: int
    type: dict

administrator_login:
    description:
    - The administrator's login name of a server.
    - Can only be specified when the server is being created (and is required for creation).
    type: str

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

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

source_server_resource_id:
    description:
    - The source server resource ID to restore from.
    - It's required when I(create_mode=PointInTimeRestore)
    type: str

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

fully_qualified_domain_name:
    description:
    - The fully qualified domain name of a server.
    type: str

administrator_login_password:
    description:
    - The administrator login password (required for server creation).
    type: str

Outputs

servers:
  contains:
    administrator_login:
      description:
      - The administrator's login name of a server.
      returned: always
      sample: azureuser
      type: str
    availability_zone:
      description:
      - Availability zone information of the server.
      returned: always
      sample: 1
      type: str
    backup:
      contains:
        backup_retention_days:
          description:
          - Backup retention days for the server.
          returned: always
          sample: 7
          type: int
        geo_redundant_backup:
          description:
          - A value indicating whether Geo-Redundant backup is enabled on the server.
          returned: always
          sample: Disabled
          type: str
      description:
      - Backup properties of a server.
      returned: always
      type: complex
    fully_qualified_domain_name:
      description:
      - The fully qualified domain name of the flexible server.
      returned: always
      sample: postflexiblefredpgsqlflexible.postgres.database.azure.com
      type: str
    high_availability:
      contains:
        mode:
          description:
          - The HA mode for the server.
          returned: always
          sample: Disabled
          type: str
        standby_availability_zone:
          description:
          - availability zone information of the standby.
          returned: always
          sample: null
          type: str
      description:
      - High availability properties of a server.
      returned: always
      type: complex
    id:
      description:
      - Resource ID of the postgresql flexible server.
      returned: always
      sample: /subscriptions/xxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforPostgreSQL/flexibleservers/postgresql3
      type: str
    location:
      description:
      - The location the resource resides in.
      returned: always
      sample: eastus
      type: str
    maintenance_window:
      contains:
        custom_window:
          description:
          - Indicates whether custom window is enabled or disabled.
          returned: always
          sample: Enabled
          type: str
        day_of_week:
          description:
          - Day of week for maintenance window.
          returned: always
          sample: 0
          type: int
        start_hour:
          description:
          - Start hour for maintenance window.
          returned: always
          sample: 8
          type: int
        start_minute:
          description:
          - Start minute for maintenance window.
          returned: always
          sample: 0
          type: int
      description:
      - Maintenance window properties of a server.
      returned: always
      type: complex
    name:
      description:
      - Resource name.
      returned: always
      sample: postgreabdud1223
      type: str
    network:
      contains:
        delegated_subnet_resource_id:
          description:
          - Delegated subnet arm resource id.
          returned: always
          sample: null
          type: str
        private_dns_zone_arm_resource_id:
          description:
          - Private dns zone arm resource id.
          returned: always
          sample: null
          type: str
        public_network_access:
          description:
          - Public network access is enabled or not.
          returned: always
          sample: Enabled
          type: str
      description:
      - Network properties of a server.
      returned: always
      type: complex
    point_in_time_utc:
      description:
      - Restore point creation time (ISO8601 format).
      returned: always
      sample: null
      type: str
    resource_group:
      description:
      - Resource group name.
      returned: always
      sample: myResourceGroup
      type: str
    sku:
      contains:
        name:
          description:
          - The name of the SKU.
          returned: always
          sample: Standard_B1ms
          type: str
        tier:
          description:
          - The tier of the particular SKU.
          returned: always
          sample: Burstable
          type: str
      description:
      - The SKU of the server.
      returned: always
      type: complex
    source_server_resource_id:
      description:
      - The source server resource ID to restore from.
      returned: always
      sample: null
      type: str
    storage:
      contains:
        storage_size_gb:
          description:
          - ax storage allowed for a server.
          returned: always
          sample: 128
          type: int
      description:
      - The maximum storage allowed for a server.
      returned: always
      type: complex
    system_data:
      contains:
        created_at:
          description:
          - The timestamp of resource creation (UTC).
          returned: always
          sample: null
          type: str
        created_by:
          description:
          - The identity that created the resource.
          returned: always
          sample: null
          type: str
        created_by_type:
          description:
          - The type of identity that created the resource.
          returned: always
          sample: null
          type: str
        last_modified_at:
          description:
          - The timestamp of resource last modification (UTC).
          returned: always
          sample: null
          type: str
        last_modified_by:
          description:
          - The identity that last modified the resource.
          returned: always
          sample: null
          type: str
        last_modified_by_type:
          description:
          - The type of identity that last modified the resource.
          returned: always
          sample: null
          type: str
      description:
      - The system metadata relating to this resource.
      returned: always
      type: complex
    tags:
      description:
      - Tags assigned to the resource. Dictionary of string:string pairs.
      returned: always
      sample:
        tag1: abc
      type: dict
    version:
      choices:
      - '11'
      - '12'
      - '13'
      description:
      - Flexible Server version.
      returned: always
      sample: '12'
      type: str
  description:
  - A list of dictionaries containing facts for PostgreSQL Flexible servers.
  returned: always
  type: complex

See also