This is the yaml I'm running and it's giving an error:
- name: Create/assign database users to db and grant permissions
mysql_user: name={{ item[0] }} password={{ item[1] }} priv={{ item[2]
}}.*:ALL state=present login_host={{ item[3] }}
with_nested:
- [ 'john' ]
- [ 'john1234' ]
- [ 'sample.sql' ]
- [ 'localhost', '%' ]
TASK: [mariadb | Create/assign database users to db and grant permissions]
>> ****
>
> failed: [192.168.50.12] => (item=['john', 'john1234', 'sample.sql',
>> 'localhost']) => {"failed": true, "item": ["john", "john1234",
>> "sample.sql", "localhost"], "parsed": false}
>
> invalid output was: Traceback (most recent call last):
>
> File
>> "/root/.ansible/tmp/ansible-tmp-1400187475.47-8611387391407/mysql_user",
>> line 1651, in <module>
>
> main()
>
> File
>> "/root/.ansible/tmp/ansible-tmp-1400187475.47-8611387391407/mysql_user",
>> line 459, in main
>
> changed = user_add(cursor, user, host, password, priv)
>
> File
>> "/root/.ansible/tmp/ansible-tmp-1400187475.47-8611387391407/mysql_user",
>> line 161, in user_add
>
> privileges_grant(cursor, user,host,db_table,priv)
>
> File
>> "/root/.ansible/tmp/ansible-tmp-1400187475.47-8611387391407/mysql_user",
>> line 289, in privileges_grant
>
> cursor.execute(query)
>
> File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in
>> execute
>
> self.errorhandler(self, exc, value)
>
> File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36,
>> in defaulterrorhandler
>
> raise errorclass, errorvalue
>
> _mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL
>> syntax; check the manual that corresponds to your MariaDB server version
>> for the right syntax to use near '.* TO 'john'@'localhost'' at line 1")
>
>
>> failed: [192.168.50.12] => (item=['john', 'john1234', 'sample.sql', '%'])
>> => {"failed": true, "item": ["john", "john1234", "sample.sql", "%"]}
>
> 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
>
>
--
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/2ba2361a-5816-4674-bc98-c3fd201b05c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.