forked from Voronenko/ansible-developer_recipes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks_mysql.yml
51 lines (44 loc) · 1.32 KB
/
tasks_mysql.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
# Parameters:
# mysql_root_password
- name: MySQL | Check if is installed
command: test -x /usr/bin/mysql
when: ansible_system == "Linux"
register: mysql_present
ignore_errors: yes
tags:
- mysql
- name: MySQL | Preset root password
shell: echo mysql-server-5.5 mysql-server/{{item}} password {{mysql_root_password}} | debconf-set-selections
when: ansible_os_family == "Debian" and mysql_present|failed
with_items:
- "root_password"
- "root_password_again"
become: yes
tags:
- mysql
- name: MySQL | Install
apt: update-cache=yes force=yes state=present pkg=mysql-server
when: ansible_os_family == "Debian" and mysql_present|failed
become: yes
tags:
- mysql
# - name: MySQL | Copy configuration file
# copy: src={{root_dir}}/files/mysql/my.cnf dest=/etc/mysql/my.cnf backup=yes
# when: ansible_os_family == "Debian"
# register: mysql_conf
# tags:
# - mysql
# become: yes
- name: MySQL | install libmysqlclient-dev
apt: name=libmysqlclient-dev update_cache=yes state=latest
when: ansible_os_family == "Debian" and mysql_present|failed
become: yes
tags:
- mysql
- name: MySQL | Restart
service: name=mysql state=restarted
# when: mysql_conf.changed
become: yes
tags:
- mysql