# Create a RDS mysql user using mysql\_user module

**URL:** <https://forum.ansible.com/t/create-a-rds-mysql-user-using-mysql-user-module/15000>\
**Category:** Ansible Developer\
**Created:** [April 11, 2014, 1:02pm UTC](https://forum.ansible.com/t/create-a-rds-mysql-user-using-mysql-user-module/15000 "2014-04-11T13:02:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prateek\_gupta](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@prateek\_gupta](https://forum.ansible.com/u/prateek_gupta)\
**Post date:** [April 11, 2014, 1:02pm UTC](https://forum.ansible.com/t/create-a-rds-mysql-user-using-mysql-user-module/15000/1 "2014-04-11T13:02:41Z")

</div>

Im trying to create a mysql user for the following

#creating a sql user

- hosts: localhost  
tasks:  
#- name: test  
mysql\_user: [host=abcde.us-west-2.rds.amazonaws.com](http://host=abcde.us-west-2.rds.amazonaws.com) login\_user=klm login\_password=msr123 name=sally password=msr123 state=absent

++++++++++2nd script++++++++++++

#creating a sql user

- hosts: localhost

- mysql\_user: [host=abcde.us-west-2.rds.amazonaws.com](http://host=abcde.us-west-2.rds.amazonaws.com) login\_user=klm login\_password=msr123 name=sally password=msr123 state=absent

but i get the following error for both of it

ERROR: Syntax Error while loading YAML script, sqluser.yml  
Note: The error may actually appear before this position: line 4, column 2

- hosts: localhost  
tasks:

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [April 11, 2014, 3:27pm UTC](https://forum.ansible.com/t/create-a-rds-mysql-user-using-mysql-user-module/15000/2 "2014-04-11T15:27:21Z")

</div>

“tasks:” should be indented and inline with “hosts”

---

<div class="post-metadata">

**Author:** ![prateek\_gupta](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@prateek\_gupta](https://forum.ansible.com/u/prateek_gupta)\
**Post date:** [April 14, 2014, 6:45am UTC](https://forum.ansible.com/t/create-a-rds-mysql-user-using-mysql-user-module/15000/3 "2014-04-14T06:45:36Z")

</div>

Hey Thanks a lot thats working now But i have got a new error as of know  
Im able to get connected to rds using mysql command but when i try to run through ansible playbook i get the following error

PLAY [localhost] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [localhost]

TASK: [mysql\_user [host=abc5.us-west-2.rds.amazonaws.com](http://host=abc5.us-west-2.rds.amazonaws.com) login\_port=3306 login\_user=abc login\_password=abc123 name=sally password=abc123 state=absent] \*\*\*  
failed: [localhost] =\> {“failed”: true}  
msg: unable to connect to database, check login\_user and login\_password are correct or ~/.my.cnf has the credentials

FATAL: all hosts have already failed – aborting

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
to retry, use: --limit @/root/sqluser.retry

localhost : ok=1 changed=0 unreachable=0 failed=1

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [April 15, 2014, 9:45pm UTC](https://forum.ansible.com/t/create-a-rds-mysql-user-using-mysql-user-module/15000/4 "2014-04-15T21:45:45Z")

</div>

Hi,

Just a quick note that is a user question, not a development question, so in the future please post this to [ansible-project@googlegroups.com](mailto:ansible-project@googlegroups.com). Thanks!
