Here's a play I use to secure the default MySQL install as per the MySQL documentation - name: MySQL setup hosts: dbservers gather_facts: true tasks: - name: ensure mysql is running and starts on boot service: name=mysql state=started enabled=true # Need to do this for idempotency, see # http://ansible.cc/docs/modules.html#mysql-user - name: update mysql root password for all root accounts mysql_u
![Secure mysql with ansible (Example)](https://cdn-ak-scissors.b.st-hatena.com/image/square/f3b04471f22b1e286ebf25dc61690e1116088b01/height=288;version=1;width=512/https%3A%2F%2Fcoderwall-assets-0.s3.amazonaws.com%2Fuploads%2Fuser%2Favatar%2F53056%2Fme-pixel.png)