title: root@localhost password set with Ansible mysql_user module doesn't work
body: <p>I have the following playbook:</p>
  
  <pre><code>- hosts: myserver
    vars:
      mysql_root_password: foobarbaz
  
  [...]
  
  tasks:
  
    [...]
  
    - name: update mysql root password for all root accounts
        mysql_user: name=root host={{ item }} password={{ mysql_root_password }} priv=*.*:ALL,GRANT
        with_items:
          - "{{ ansible_hostname }}"
          - 127.0.0.1
          - ::1
          - "localhost"
        become: true
        tags: mysql
  
    [...]
  
    # I've ommitted the tasks to install the mysql packages, 
    # store the password in /root/.my.cnf and restart the server)
  </code></pre>
  
  <p>The problem is the desired pasword is correctly saved in mysql.user for 127.0.0.1, ::1 and the hostname <strong>but not</strong> for localhost, i.e.</p>
  
  <pre><code>mysql&gt; select host,user,authentication_string from user;
  +-----------+------------------+-------------------------------------------+
  | host      | user             | authentication_string                     |
  +-----------+------------------+-------------------------------------------+
  | localhost | root             |                                           |
  | localhost | mysql.sys        | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
  | localhost | debian-sys-maint | *DA57FEBA9C5C5119186DB8834C7B83216E450117 |
  | ubuntu    | root             | *8C5206E23A3B76002AA6E152691F5C5D7ABC31F9 |
  | 127.0.0.1 | root             | *8C5206E23A3B76002AA6E152691F5C5D7ABC31F9 |
  | ::1       | root             | *8C5206E23A3B76002AA6E152691F5C5D7ABC31F9 |
  +-----------+------------------+-------------------------------------------+
  </code></pre>
  
  <p>Where *8C52... is the encrypted password:</p>
  
  <pre><code>mysql&gt; select password('foobarbaz');
  +-------------------------------------------+
  | password('foobarbaz')                     |
  +-------------------------------------------+
  | *8C5206E23A3B76002AA6E152691F5C5D7ABC31F9 |
  +-------------------------------------------+
  </code></pre>
  
  <p>Therefore, this fails:</p>
  
  <pre><code>william@ubuntu:/etc/mysql$ mysql -u root --password=foobarbaz
  mysql: [Warning] Using a password on the command line interface can be insecure.
  ERROR 1698 (28000): Access denied for user 'root'@'localhost'
  </code></pre>
  
  <p>and also if I use sudo, I can connect to mysql as root using any password or none.</p>
  
  <p>To put it another way, this ansible command doesn't do anything, but if I use any other user or host it works.</p>
  
  <pre><code>ansible myserver -m mysql_user -a "name=root host=localhost password=foobarbaz priv=*.*:ALL,GRANT" -b
  myserver | SUCCESS =&gt; {
      "changed": true,
      "user": "root"
  }
  </code></pre>
  
  <p>MySQL: Ver 14.14 Distrib 5.7.15<br>
  Ubuntu 16.04.1 LTS<br>
  Ansible 2.1.2.0</p>