ansible-collections / azure

Development area for Azure Collections
https://galaxy.ansible.com/azure/azcollection
GNU General Public License v3.0
246 stars 330 forks source link

Trying to create a postgresqlflexibleserver fail with an API internal server error #1716

Open mbegoc opened 1 week ago

mbegoc commented 1 week ago
SUMMARY

When trying to create a postgresqlflexibleserver with ansible, I end up with a fatal server error and absolutely no output to understand what's happening. It works fine with postgresqlserver though.

ISSUE TYPE
COMPONENT NAME

azure.azcollection.azure_rm_postgresqlflexibledatabase

ANSIBLE VERSION
ansible [core 2.17.4]
  config file = None
  configured module search path = ['/home/michel/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/michel/ws/projects/mypath-sa/venv/lib/python3.12/site-packages/ansible
  ansible collection location = /home/michel/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/michel/ws/projects/mypath-sa/venv/bin/ansible
  python version = 3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0] (/home/michel/ws/projects/mypath-sa/venv/bin/python)
  jinja version = 3.1.4
  libyaml = True
COLLECTION VERSION
Collection         Version
------------------ -------
azure.azcollection 2.7.0  

# /home/michel/ws/projects/mypath-sa/venv/lib/python3.12/site-packages/ansible_collections
Collection         Version
------------------ -------
azure.azcollection 2.7.0 
CONFIGURATION
CONFIG_FILE() = None
EDITOR(env: EDITOR) = vim
OS / ENVIRONMENT

Linux Mint 22 Wilma

STEPS TO REPRODUCE
- name: make db creation fail
  azure.azcollection.azure_rm_postgresqlflexibleserver:                                                
    name: dbserver                                                                                         
    version: 16                                                                                        
    administrator_login: admin_login                                                                          
    administrator_login_password: ###########                                                          
    resource_group: myresourcegroup                                                                      
    sku:                                                                                            
      name: Standard_B1ms                                                                           
      tier: Burstable
EXPECTED RESULTS

Database creation, or at least an error saying what's going on.

ACTUAL RESULTS
The full traceback is:
  File "/tmp/ansible_azure.azcollection.azure_rm_postgresqlflexibleserver_payload_2r8g4x2b/ansible_azure.azcollection.azure_rm_postgresqlflexibleserver_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_postgresqlflexibleserver.py", line 862, in create_postgresqlflexibleserver
    response = self.get_poller_result(response)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_azure.azcollection.azure_rm_postgresqlflexibleserver_payload_2r8g4x2b/ansible_azure.azcollection.azure_rm_postgresqlflexibleserver_payload.zip/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py", line 635, in get_poller_result
    poller.wait(timeout=delay)
  File "/home/michel/ws/projects/mypath-sa/venv/lib/python3.12/site-packages/azure/core/tracing/decorator.py", line 76, in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/michel/ws/projects/mypath-sa/venv/lib/python3.12/site-packages/azure/core/polling/_poller.py", line 261, in wait
    raise self._exception  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^
  File "/home/michel/ws/projects/mypath-sa/venv/lib/python3.12/site-packages/azure/core/polling/_poller.py", line 176, in _start
    self._polling_method.run()
  File "/home/michel/ws/projects/mypath-sa/venv/lib/python3.12/site-packages/azure/core/polling/base_polling.py", line 745, in run
    raise HttpResponseError(response=self._pipeline_response.http_response, error=err) from err
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "ad_user": null,
            "adfs_authority_url": null,
            "administrator_login": "admin_login",
            "administrator_login_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "api_profile": "latest",
            "append_tags": true,
            "auth_source": "auto",
            "availability_zone": null,
            "backup": null,
            "cert_validation_mode": null,
            "client_id": null,
            "cloud_environment": "AzureCloud",
            "create_mode": null,
            "disable_instance_discovery": false,
            "fully_qualified_domain_name": null,
            "high_availability": null,
            "identity": null,
            "is_restart": false,
            "is_start": false,
            "is_stop": false,
            "location": null,
            "log_mode": null,
            "log_path": null,
            "maintenance_window": null,
            "name": "test",
            "network": null,
            "password": null,
            "point_in_time_utc": null,
            "profile": null,
            "resource_group": "myresourcegroup",
            "secret": null,
            "sku": {
                "name": "Standard_B2ms",
                "tier": "Burstable"
            },
            "source_server_resource_id": null,
            "state": "present",
            "storage": null,
            "subscription_id": null,
            "tags": null,
            "tenant": null,
            "thumbprint": null,
            "version": "16",
            "x509_certificate_path": null
        }
    },
    "msg": "Error creating the PostgreSQL Flexible Server instance: (InternalServerError) An unexpected error occured while processing the request. Tracking ID: '00d0955c-e4e1-48e3-a57b-e5868f78523d'\nCode: InternalServerError\nMessage: An unexpected error occured while processing the request. Tracking ID: '00d0955c-e4e1-48e3-a57b-e5868f78523d'"
}
zikalino commented 5 days ago

@mbegoc could you tell what is the region you're trying to create this PostgreSQL instance in?

Additionally, just to check whether issue is related to Ansible or something else, could you try following Azure CLI command?

az postgres flexible-server create --resource-group ${resource_group_name} --name ${postgresql_server_name} --admin-user ${postgresql_server_username} --admin-password ${postgresql_server_password} --sku-name Standard_B1ms --tier Burstable --version 16

Fred-sun commented 5 days ago

@mbegoc This may be due to subscription failure due to region limit, is currently being processed, thank you!

mbegoc commented 5 days ago

@mbegoc could you tell what is the region you're trying to create this PostgreSQL instance in?

Canada East.

Additionally, just to check whether issue is related to Ansible or something else, could you try following Azure CLI command?

az postgres flexible-server create --resource-group ${resource_group_name} --name ${postgresql_server_name} --admin-user ${postgresql_server_username} --admin-password ${postgresql_server_password} --sku-name Standard_B1ms --tier Burstable --version 16

The CLI command works. I used it as a workaround with ansible error management. Once the server is created, the ansible module work well to update the existing server.

So, it feels like something need to be fixed on the API side, but maybe some parameters or something can be updated on the module side as well since the CLI works as expected.