Sandy Walsh b99a74198f my.cnf was going to wrong location.
Got schooled on the difference between .my.cnf and my.cnf. This
should be correct now.

Change-Id: I5f23ae5dc9e824153fb9e85a11e09e422ed1e0f2
2015-01-07 11:26:28 -08:00

28 lines
1.0 KiB
YAML

## Main task file for stv3-db role
---
- name: install mysql-server
apt: name=mysql-server update_cache=yes
- name: install python mysql lib
apt: name=python-mysqldb
- 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_user: name=root host=localhost password={{ root_db_password }}
# tricky ... could have already been change from a previous run?
ignore_errors: yes
- name: copy .my.cnf file with root password credentials
template: src=my.cnf.j2 dest=/etc/mysql/my.cnf owner=root mode=0600
notify:
- restart_mysql
- mysql_db: name=winchester state=present login_user=root login_password={{ root_db_password }}
- name: create winchester db user
mysql_user: name=winchester host=localhost password={{ winchester_db_password }} priv=*.*:ALL \
login_user=root login_password={{ root_db_password}}