---
- hosts: database
  become: true
  tasks:
    - name: Remove packages for a VM problem using mysql
      command: apt-get -y purge mysql-server mysql-client mysql-common

    - name: install mysql-server
      apt: name=mysql-server state=present update_cache=yes

    - name: ensure mysql started
      service: name=mysql state=started enabled=yes

    - name: ensure mysql listening on all ports
      lineinfile: dest=/etc/mysql/my.cnf regexp=^bind-address line="bind-address = 0.0.0.0"