Add files, handlers, tasks, vars, and meta information.

This commit is contained in:
Jeff Geerling
2014-02-28 21:32:17 -06:00
parent 032333dbe0
commit 8082fd69b9
6 changed files with 101 additions and 0 deletions

38
tasks/main.yml Normal file
View File

@@ -0,0 +1,38 @@
---
# If this is not done for the version of MySQL in certain extra repositories,
# MySQL installation fails with an error the first time.
- name: Update postfix to the latest version.
yum: name=postfix state=latest enablerepo={{ mysql_enablerepo }}
- name: Ensure MySQL packages are installed.
yum: name={{ item }} state=installed enablerepo={{ mysql_enablerepo }}
with_items:
- mysql
- mysql-server
- MySQL-python
- name: Copy my.cnf global MySQL configuration.
copy: src=my.cnf dest=/etc/my.cnf owner=root group=root mode=0644
# Set MySQL to run at startup.
- name: Ensure MySQL is started.
service: name=mysqld state=started enabled=yes
# 'localhost' needs to be the last item 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={{ item }} password={{ mysql_root_password }}
with_items:
- 127.0.0.1
- ::1
- localhost
# Has to be after the root password assignment, for idempotency.
- name: Copy .my.cnf file with root password credentials.
template: src=my.cnf.j2 dest=/root/.my.cnf owner=root group=root mode=0600
- name: Delete anonymous MySQL user for localhost.
mysql_user: name="" state="absent"
- name: Remove the MySQL test database.
mysql_db: name="test" state="absent"