Using Tower 2.1 I have a playbook which creates a stack including a Cloud DB instance, user and DB.
This works fine, but on running the playbook again, it fails with:
msg: A user with the name “xxxxxxxxxx” already exists.
(The username has special characters if that’s any help).
I’ve pasted the YAML for creating the DB and user below - am I missing something obvious or is this module not idempotent?
I have been unable to duplicate this issue. The code in place in rax_cdb_user tries to perform a instance.get_user on the username. If the username exists the user object is returned. If an Exception is raised, the function returns False and the module attempts to create the user.
In your case, it sounds like the user does exist, but an Exception is being raised for some reason, that does not indicate the absence of a user. You could try to make the following change to rax_cdb_user.py (which I may do anyway):
Thank you Matt.
I made the change you suggested but still get the same result with no extra information.
I then tried a db username with no special characters and it works fine - sorry, I should have tried this first.
Here is the db username that doesn’t work:
S+%{r.46Z?f_*JuB
The module can create a user with this name OK, but it fails on the 2nd run.
Not a problem for me at the moment as we will just use a different name.
Thank you for the feedback. I will look into this and see if it is a limitation of the API, pyrax or where ever else. If I can find a solution I’ll look into applying a fix.