Hello Everyone,
I’ve been working on a simple playbook to add multiple-users to a mysql-database using the mysql_user module.
One thing I’ve discovered is that every time I rerun the playbook, it’ll reset the password, for an already-existing account, to whatever is set in the mysql_user module.
This makes sense given the nature of the command
Example:
name: create mysql_prod user(s)
mysql_user: login_host=database.foo.com login_user=${LOGIN_USER} login_password=${LOGIN_PASS} name=${item} host=${HOST} password=${PASS} priv=${PRIV} state=${STATE}
with_items: ${users}
Obviously this behavior is fine for new users, however as time progresses and the number of users increase, the likelihood of overwriting a user-password increases.
Is there a way where I could test if the user exists and skip the password change?
Hopefully this makes sense.
Thank you.
–Mike