-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
azure_rm_roleassignment fails when the role assignment already exists #145
Comments
As a workaround for this, I have found that including a name allows it to be idempotently set, though you would have to manually clear the previous un-named registrations |
@Chaffelson thanks for the potential workaround, but it's not working for me. If I set the
My generated string is not a GUID. I suppose I could make it one, but it's not clear to me that I should do this. Can you post a working example of your workaround? |
I construct the name string by combining the two parts of the role and assignee names, then push through to_uuid.
Also, while you're using this sub component, you should know that
|
@wrprice Thank you for submitting this question. I checked this module. The previous design is not idempotent. I am discussing with the community maintainers whether we need to add this feature! Before determining the solution, you can follow the method suggested above, or delete and determine whether the segment exists before creating it to determine whether it needs to be created. Thank you! |
I'm also running into this issue. Unfortunately, recreating all of our existing role assignments using the workaround posted above would not be feasible for us. My less efficient workaround is to check for the assignment first with azure_rm_roleassignment_info. Then I've conditionalized azure_rm_roleassignment to run only if the assignment was not found. |
Is anyone actively working on this? I just submitted a PR for improving the roleassignment_info module, and the roleassignment module is next in my sights. I was planning on adding the ability to check for existing assignments matching the role, scope, and assignee, and if they match then consider it existing / no change, this will also make it idempotent if name is omitted and a random guid is created. |
@paultaiton We will review your PR submission as soon as possible. Thanks you very much! |
Migrating from ansible/ansible#67529 unrequested but on behalf of @adhodgson1. The details below are copied from that report.
SUMMARY
The azure_rm_roleassignment module runs in a playbook fine the first time but on subsequent plays it throws an error that the role already exists.
ISSUE TYPE
COMPONENT NAME
azure_rm_roleassignment
ANSIBLE VERSION
Tested with Ansible 2.8.5 and 2.9.5 installed via Pip with the ansible[azure] packages
STEPS TO REPRODUCE
EXPECTED RESULTS
All plays run without error.
ACTUAL RESULTS
First play completes successfully, subsequent plays fail:
The text was updated successfully, but these errors were encountered: