ansible-mysql/tasks/main.yml

40 lines
1.0 KiB
YAML
Raw Normal View History

2015-07-12 15:42:46 +07:00
---
- name: INCLUDE_VARS | Related to Debian version
include_vars: "{{ ansible_distribution_release }}.yml"
- name: STAT | Check if mysql exists
stat: path=/etc/init.d/mysql
register: mysql_exists
changed_when: false
2015-07-12 17:47:44 +07:00
- name: INCLUDE | Install
include: install.yml
2015-07-12 15:42:46 +07:00
- name: TEMPLATE | Deploy daemon configuration
template: src=etc/mysql/conf.d/90-config.cnf.j2 dest=/etc/mysql/conf.d/90-config.cnf
2015-07-12 15:42:46 +07:00
notify: restart mysql
- name: TEMPLATE Create .my.cnf for root
template: src=root/my.cnf dest=/root/.my.cnf owner=root group=root mode=0600 backup=yes
2015-08-08 04:34:47 +07:00
- name: SERVICE | Ensure daemon is started
service: name=mysql state=started
2015-07-12 15:42:46 +07:00
- name: INCLUDE | Secure install
include: 'secure.yml'
- name: MYSQL_DB | Create databases
mysql_db: name={{ item }} state=present
with_items: mysql_databases
- name: MYSQL_USER | Manages users...
2015-08-08 18:02:59 +07:00
mysql_user: >
name={{ item.name }}
password={{ item.password }}
priv={{ item.priv }}
host={{ item.host | default('localhost') }}
state=present
2015-07-12 15:42:46 +07:00
with_items: mysql_users