blob: b6b2f1fa3870ebae5f702d8d17a0c73ff627b9cb (
plain)
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
|
---
# This role will install MySQL and create db user and give permissions.
- name: Install Mysql package
yum:
name: "{{ item }}"
state: present
with_items:
- mysql-server
- MySQL-python
- name: Configure SELinux to start mysql on any port
seboolean:
name: mysql_connect_any
state: true
persistent: yes
when: sestatus.rc != 0
- name: Create Mysql configuration file
template:
src: my.cnf.j2
dest: /etc/my.cnf
notify:
- restart mysql
- name: Start Mysql Service
service:
name: mysqld
state: started
enabled: yes
- 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
|