Azure / azure_preview_modules

Azure preview modules for Ansible
https://galaxy.ansible.com/azure/azure_preview_modules
43 stars 49 forks source link

azure_rm_storageaccount | Always already taken. - Reason.already_exists #125

Closed mvdpoel closed 5 years ago

mvdpoel commented 6 years ago

Hi,

Trying to run this module but it's not idempotent. It keeps returning:

"The storage account named xxx is already taken. - Reason.already_exists"

Returns:

TASK [az_create_storage_account : Ensure Storage Account Exists] ***** task path: /opt/ansible/roles/ansible_role_az_create_storage_account/tasks/main.yml:2 fatal: [localhost]: FAILED! => {"changed": false, "msg": "The storage account named xxx is already taken. - Reason.already_exists"}

Fred-sun commented 6 years ago

@mvdpoel I have try to create storage account to verify idempotent on ansbile(2.6.0 and 2.6.3) all get successfully result, could you share your ansible verison and upgrade ansible to try again( Upgrade ansible to new: sudo pip install ansible[azure] --upgrade -I ). Thanks!


my test result:
fred@fred-Virtual-Machine:~/task/125$ ansible-playbook  125.yml 

PLAY [create stoage account] ***************************************************

TASK [Gathering Facts] *********************************************************
ok: [127.0.0.1]

TASK [Ensure storage account exist] ********************************************
changed: [127.0.0.1]

PLAY RECAP *********************************************************************
127.0.0.1                  : ok=2    changed=1    unreachable=0    failed=0   

fred@fred-Virtual-Machine:~/task/125$ ansible-playbook  125.yml 

PLAY [create stoage account] ***************************************************

TASK [Gathering Facts] *********************************************************
ok: [127.0.0.1]

TASK [Ensure storage account exist] ********************************************
ok: [127.0.0.1]

PLAY RECAP *********************************************************************
127.0.0.1                  : ok=2    changed=0    unreachable=0    failed=0 
Fred-sun commented 6 years ago

In order for the community to handle your issue effectively, You can description of the issue with this template: https://raw.githubusercontent.com/ansible/ansible/devel/.github/ISSUE_TEMPLATE.md. Thanks

Fred-sun commented 6 years ago

@mvdpoel Do you have try again? Could you help share your test result? Thanks!

Fred-sun commented 6 years ago

@mvdpoel Thanks for the contribution, It seem not a bug, just name already exist or use old ansible version. Could you help share you test result or some detail info?

Fred-sun commented 6 years ago

@mvdpoel Thanks for the contribution, Could you help recheck this issue? it seem not a bug, just the storage account name has already exist. Thanks!

yuwzho commented 6 years ago

@Fred-sun Have you ever verified the preview role?

Fred-sun commented 6 years ago

@mvdpoel Thanks for the contribution. I have retested again. this module has idempotent. if the storage account has exist, will get this error. I think your account name may has been created by other credential or this account name has existed on other resource group. Thanks!.

Fred-sun commented 6 years ago

@mvdpoel Thanks for the contribution, Could you help retry and share you test result to us? Thanks!

Fred-sun commented 6 years ago

@mvdpoel thanks for the contribution. Are you still here? do you still have this question? Thanks!

Fred-sun commented 6 years ago

@mvdpoel thanks for the contribution. Are you still here? Could we can close this issue? Thanks!

Fred-sun commented 5 years ago

@yuwzho @yungezz The issue has no update more than one month, I have tested, this is not a bug, Could we can close this issue? Thanks!

Fred-sun commented 5 years ago

@mvdpoel Thanks for you contribution, Are you still here? Could we can close this issue( not a bug)? Thanks!

Fred-sun commented 5 years ago

@yungezz Could you help check this issue? this may not a bug, just the storageaccount name already in resource. Thanks!

yungezz commented 5 years ago

@mvdpoel could you pls share ansible version? the issue doesn't exist in latest ansible 2.7. could you pls try against ansilbe 2.7?

Fred-sun commented 5 years ago

@yungezz Could we can close the problem? re-open it when we encounter it again, and ask contributors for more information. Thanks!

Fred-sun commented 5 years ago

not a bug, can be closed.

yungezz commented 5 years ago

close this for now. verified azure_rm_storageaccount module idempotent works. pls open new issue if met this again with playbook snippets and repo steps. thanks.

michael-niemand commented 4 years ago

To anybody arriving here via Google, looking for an answer: As the documentation states, storage account names have to be unique across all of Azure. There are most likely more elegant ways to solve this, but here's what I did: azure_k8s_cluster_sa_name: "{{ 'mystorage' | to_uuid | lower | replace('-', '') | truncate(24, True, '') }}"

obviously you need to change 'mystorage' to something else or it will fail, too.