ansible/roles/mysql/tasks/main.yml
Salt 0d8f6f4a97 Use MySQL query to promote new user to admin
Because that doesn't happen by default
2020-04-30 07:56:36 -05:00

34 lines
705 B
YAML

#!/usr/bin/ansible-playbook
# vim:ft=ansible:
---
- name: Set up MySQL
block:
- name: Install MySQL
apt:
name: "{{ packages }}"
vars:
packages:
- mariadb-server
- python3-mysqldb
- python3-pymysql
- name: Start MySQL
service:
name: mysql
state: started
enabled: true
- name: Update root password
mysql_user:
name: root
host: "{{ item }}"
password: "{{ mysql_root_password }}"
login_user: root
login_password: "{{ mysql_root_password }}"
check_implicit_admin: yes
priv: "*.*:ALL,GRANT"
loop:
- "{{ ansible_hostname }}"
- 127.0.0.1
- ::1
- localhost
become: true