ansible-role-apache/tasks/main.yml
2014-03-06 22:34:00 -06:00

35 lines
1.3 KiB
YAML

---
# 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_packages
- 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"