mariadb: Add support for setting root password
This commit is contained in:
parent
45ed2678e7
commit
e81de8a9ff
1 changed files with 24 additions and 1 deletions
|
@ -1,8 +1,11 @@
|
|||
---
|
||||
- name: install packages
|
||||
package:
|
||||
name: mariadb-server
|
||||
name: "{{ item }}"
|
||||
state: installed
|
||||
with_items:
|
||||
- mariadb-server
|
||||
- python3-PyMySQL
|
||||
|
||||
- name: fix selinux contexts from data directory
|
||||
sefcontext:
|
||||
|
@ -56,3 +59,23 @@
|
|||
name: mariadb
|
||||
state: started
|
||||
enabled: true
|
||||
|
||||
- name: set root password
|
||||
mysql_user:
|
||||
name: root
|
||||
password: "{{ mariadb_root_password }}"
|
||||
login_user: root
|
||||
login_password: "{{ mariadb_root_password }}"
|
||||
check_implicit_admin: true
|
||||
login_unix_socket: /var/lib/mysql/mysql.sock
|
||||
no_log: true
|
||||
when: mariadb_root_password is defined
|
||||
|
||||
- name: create root .my.cnf
|
||||
template:
|
||||
dest: /root/.my.cnf
|
||||
src: my.cnf.j2
|
||||
mode: 0600
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
when: mariadb_root_password is defined
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue