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):

https://gist.github.com/sivel/3b41dd88147f7d99cab2

If that raises some other error, it might help track down why that user
cannot be found on the instance.

On Wed, Jan 14, 2015 at 8:31 AM, David Goodall <[email protected]>
wrote:

> Hi,
>
> 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?
>
> Best regards,
> David
>
>     - name: Create cloud DB server
>       rax_cdb:
>         credentials: ~/.rax.creds
>         region: LON
>         name: "{{ db_server }}"
>         flavor: 1
>         volume: 2
>         wait: yes
>         state: present
>       register: rax_db_server
>
>     - name: Create cloud DB
>       rax_cdb_database:
>         credentials: ~/.rax.creds
>         region: LON
>         cdb_id: "{{rax_db_server.cdb.id}}"
>         name: "{{ db_name }}"
>         state: present
>       register: rax_db_database
>
>     - name: Create cloud DB user
>       rax_cdb_user:
>         credentials: ~/.rax.creds
>         region: LON
>         cdb_id: "{{rax_db_server.cdb.id}}"
>         db_username: "{{ db_user }}"
>         db_password: "{{ db_password }}"
>         databases:
>           - "{{rax_db_database.database.name}}"
>         state: present
>       register: rax_db_user
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/a860e219-6775-43e6-9b85-b95a0e8e20c4%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/a860e219-6775-43e6-9b85-b95a0e8e20c4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v9CghGXe3q%3DOJ1SOr_1JmmJcVLo7cLtBga3_H9z5RA-Vw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to