You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
36 lines
1.1 KiB
---
|
|
# This playbook will install MariaDB and create db user and give permissions.
|
|
|
|
- name: Install MariaDB package
|
|
yum: name={{ item }} state=installed
|
|
with_items:
|
|
- mariadb-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
|
|
template: src=my.cnf.j2 dest=/etc/my.cnf
|
|
notify:
|
|
- restart mariadb
|
|
|
|
- name: Create MariaDB log file
|
|
file: path=/var/log/mysqld.log state=touch owner=mysql group=mysql mode=0775
|
|
|
|
- name: Create MariaDB PID directory
|
|
file: path=/var/run/mysqld state=directory owner=mysql group=mysql mode=0775
|
|
|
|
- name: Start MariaDB Service
|
|
service: name=mariadb state=started enabled=yes
|
|
|
|
- name: insert firewalld rule
|
|
firewalld: port={{ mysql_port }}/tcp permanent=true state=enabled immediate=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
|
|
|