mysql_secret

According to
http://dev.mysql.com/doc/refman/5.6/en/linux-installation-rpm.html

As of MySQL 5.6.8, if using rpm installation, mysql is automatically setup with a random password stored in
$HOME/.mysql_secret

the file contains text like the following

The random password set for the root user at Thu Jul 18 10:29:03 2013 (local time): dWtTd33T

I want to keep my ansible scripts idempotent.

How can I grab the value of the password and use that with “mysql_user” ?
Is there something like “lineinfile” but instead of managing lines that match, it takes the regex match and saves to an ansible variable?
Then using that variable, I can set it to the password of mysql_user

Mike

so aside from a shell command + register var, it looks like if you want it to not returned ‘changed’ you need a custom fact that does same.