# mysql\_user errors when using with\_items

**URL:** <https://forum.ansible.com/t/mysql-user-errors-when-using-with-items/21987>\
**Category:** Ansible Project\
**Created:** [July 11, 2016, 3:05pm UTC](https://forum.ansible.com/t/mysql-user-errors-when-using-with-items/21987 "2016-07-11T15:05:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_Sault](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@Jeff\_Sault](https://forum.ansible.com/u/Jeff_Sault)\
**Post date:** [July 11, 2016, 3:05pm UTC](https://forum.ansible.com/t/mysql-user-errors-when-using-with-items/21987/1 "2016-07-11T15:05:29Z")

</div>

Hi All,

Does anyone know why the below ansible code is failing?

- name: Add permissions to heeservers to connect to SQL  
mysql\_user: name={{ mu\_db\_user }} password={{ mu\_db\_pass }} host=“{{ item }}” priv={{ mu\_db\_name }}.\*:ALL state=present  
with\_items: ‘{{groups.heeservers}}’

The error reported is…

failed: [mu.vagrant] (item=hee.vagrant) =\> {“failed”: true, “item”: “hee.vagrant”, “msg”: “(1396, "Operation CREATE USER failed for ‘root’@‘hee.vagrant’")”}

If I change the host from “{{ item }}” to a fixed string it works as expected but I dont understand why.

Thanks!  
Jeff

---

<div class="post-metadata">

**Author:** ![Jeff\_Sault](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@Jeff\_Sault](https://forum.ansible.com/u/Jeff_Sault)\
**Post date:** [July 18, 2016, 8:35am UTC](https://forum.ansible.com/t/mysql-user-errors-when-using-with-items/21987/2 "2016-07-18T08:35:12Z")

</div>

Anyone?
