# Mysql Idempotency Failure

**URL:** <https://forum.ansible.com/t/mysql-idempotency-failure/15689>\
**Category:** Ansible Project\
**Created:** [July 17, 2014, 11:40am UTC](https://forum.ansible.com/t/mysql-idempotency-failure/15689 "2014-07-17T11:40:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chinmaya\_Patanaik](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@Chinmaya\_Patanaik](https://forum.ansible.com/u/Chinmaya_Patanaik)\
**Post date:** [July 17, 2014, 11:40am UTC](https://forum.ansible.com/t/mysql-idempotency-failure/15689/1 "2014-07-17T11:40:45Z")

</div>

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](http://stackoverflow.com/questions/16444306/ansible-idempotent-mysql-installation-playbook)
2. [https://groups.google.com/forum/#!topic/ansible-project/-jSfGwpk5J8](https://groups.google.com/forum/#!topic/ansible-project/-jSfGwpk5J8)

Target Server - Amazon Linux AMI(YUM based distro)

My Playbook looks like this.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 17, 2014, 12:33pm UTC](https://forum.ansible.com/t/mysql-idempotency-failure/15689/2 "2014-07-17T12:33:53Z")

</div>

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 🙂 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.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 17, 2014, 12:34pm UTC](https://forum.ansible.com/t/mysql-idempotency-failure/15689/3 "2014-07-17T12:34:05Z")

</div>

s/vault/fault/

(Freudian slip?)

---

<div class="post-metadata">

**Author:** ![Chinmaya\_Patanaik](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@Chinmaya\_Patanaik](https://forum.ansible.com/u/Chinmaya_Patanaik)\
**Post date:** [July 17, 2014, 2:28pm UTC](https://forum.ansible.com/t/mysql-idempotency-failure/15689/4 "2014-07-17T14:28:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Matt\_Coddington](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Matt\_Coddington](https://forum.ansible.com/u/Matt_Coddington)\
**Post date:** [July 17, 2014, 2:35pm UTC](https://forum.ansible.com/t/mysql-idempotency-failure/15689/5 "2014-07-17T14:35:18Z")

</div>

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
