-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmariadb.yml
70 lines (60 loc) · 1.32 KB
/
mariadb.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
- name: Install MariaDB packages
dnf:
name:
- mariadb-server
- mariadb
- python3-PyMySQL.noarch
state: present
- name: Start the MariaDB Services
systemd:
name: mariadb
state: started
enabled: yes
- name: update mysql root password for all root accounts
mysql_user:
name: root
host: localhost
password: "{{ root_db_password }}"
- name: copy .my.cnf file with root password credentials
template:
src: templates/root/.my.cnf
dest: /root/.my.cnf
owner: root
mode: '0600'
tags: cnf
- name: update mysql root password login for all root accounts
mysql_user:
name: root
host: "{{ item }}"
password: "{{ root_db_password }}"
with_items:
- "{{ ansible_hostname }}"
- 127.0.0.1
- ::1
tags: rootpassword
- name: ensure anonymous users are not in the database
mysql_user:
name: ''
host_all: yes
state: absent
- name: remove the test database
mysql_db:
name: test
state: absent
- name: add zabbix
mysql_db:
name: zabbix
collation: utf8_bin
encoding: utf8
state: present
notify: import zabbix schema
- name: Meta Zabbix db
meta: flush_handlers
- name: add zabbix db user
mysql_user:
name: zabbix
password: "{{ dbpass }}"
priv: 'zabbix.*:ALL'
host: localhost
state: present