2013-03-12 17:35:25 +01:00
|
|
|
---
|
2013-03-20 06:07:11 +01:00
|
|
|
# This playbook will install MySQL and create db user and give permissions.
|
2013-03-12 17:35:25 +01:00
|
|
|
|
|
|
|
- name: Install Mysql package
|
2013-04-07 21:31:00 +02:00
|
|
|
yum: pkg=$item state=installed
|
2013-03-12 17:35:25 +01:00
|
|
|
with_items:
|
|
|
|
- mysql-server
|
|
|
|
- MySQL-python
|
|
|
|
- libselinux-python
|
|
|
|
- libsemanage-python
|
|
|
|
|
|
|
|
- name: Configure SELinux to start mysql on any port
|
|
|
|
seboolean: name=mysql_connect_any state=true persistent=yes
|
|
|
|
|
|
|
|
- name: Create Mysql configuration file
|
2013-04-07 21:31:00 +02:00
|
|
|
template: src=my.cnf.j2 dest=/etc/my.cnf
|
2013-03-12 17:35:25 +01:00
|
|
|
notify:
|
|
|
|
- restart mysql
|
|
|
|
|
|
|
|
- name: Start Mysql Service
|
|
|
|
service: name=mysqld state=started enabled=true
|
|
|
|
|
|
|
|
- name: Create Application Database
|
|
|
|
mysql_db: name=$dbname state=present
|
|
|
|
|
|
|
|
- name: Create Application DB User
|
|
|
|
mysql_user: name=$dbuser password=$upassword priv=*.*:ALL host='%' state=present
|