Mysql Idempotency Failure

Hi,

I am trying to incorporate mysql secure installation using Ansible playbook. I followed the below links.

  1. http://stackoverflow.com/questions/16444306/ansible-idempotent-mysql-installation-playbook
  2. https://groups.google.com/forum/#!topic/ansible-project/-jSfGwpk5J8

Target Server - Amazon Linux AMI(YUM based distro)

My Playbook looks like this.

Minor pet peeve - That’s not an idempotency failure, you have trouble logging into a MySQL database.

I will stick voodoo pins into those that made use of that word so commonly confused :slight_smile: Not your vault of course.

I do notice you are using horribly dated Ansible syntax with

“host=”$server_hostname""

Variables look like {{ server_hostname }} not $server_hostname

This may be your problem.

s/vault/fault/

(Freudian slip?)

Thanks. I didn’t notice “host=”$server_hostname"" thing as the play ended before that task. The task which failed is “name: update mysql root password for all root accounts”.

I am struggling with this all day. Any help is appreciated.

i would guess it’s an ordering thing. the play prior to the failed one you are templating your .my.cnf. if that template is also using {{ mysql_root_password }} then you have locked yourself out of mysql by updating your .my.cnf with the new password prior to changing it. put the correct current password in your .my.cnf, then move that template to after where you call mysql_user to update your password.

matt