Can I convince anybody that the mysql_db state=import behavior is a bug?

Hi,

As discussed at here a long time ago,mysql_db state=import will import the given file unconditionally.

There’s a good chance the database has been updated since the original run of ansible, so this behavior means users should never run ansible after the server goes public.

The link above discusses several options for only running import once, but the nuances and trade-offs of each are lost on me as a non-expert.

I would suggest that, since we’re not talking about a write-once sort of target like conf files in /etc, this behavior is bad. In fact, it just now nearly wiped out a bunch of data for me as I made a configuration change and confidently (stupidly?) re-ran my ansible script.

The import function should refuse to import data if there’s already data in the database. Or, it shouldn’t be it’s own ‘state’ (not really a state) and be a part of the actions done for state == ‘present’.

Have I convinced anybody? If so, I’ll file a bug on GitHub… didn’t want to clutter that if I’m off the mark.