mariadb: Initial version of role

This commit is contained in:
Timo Makinen 2021-03-31 22:15:29 +00:00
parent 61d4754bf1
commit 3f9de759aa
2 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
- name: restart mariadb
service:
name: mariadb
state: restarted

View file

@ -0,0 +1,41 @@
---
- name: install packages
package:
name: mariadb-server
state: installed
- name: fix selinux contexts from data directory
sefcontext:
path: "/export/mariadb(/.*)?"
setype: mysqld_db_t
- name: create data directory
file:
path: /export/mariadb
state: directory
mode: 0750
owner: mysql
group: mysql
setype: _default
- name: link data diretory
file:
dest: /srv/mariadb
src: /export/mariadb
state: link
owner: root
group: "{{ ansible_wheel }}"
follow: false
- name: configure data directory
lineinfile:
path: /etc/my.cnf.d/mariadb-server.cnf
regexp: "^datadir=.*"
line: datadir=/srv/mariadb
notify: restart mariadb
- name: enable service
service:
name: mariadb
state: started
enabled: true