2020-02-05 23:29:39 -06:00
|
|
|
#!/usr/bin/ansible-playbook
|
|
|
|
# vim:ft=ansible:
|
|
|
|
---
|
|
|
|
- name: Set up MySQL
|
|
|
|
block:
|
|
|
|
- name: Install MySQL
|
|
|
|
apt:
|
|
|
|
name: "{{ packages }}"
|
|
|
|
vars:
|
|
|
|
packages:
|
|
|
|
- mariadb-server
|
2020-04-26 02:05:32 -05:00
|
|
|
- python3-mysqldb
|
2020-02-05 23:29:39 -06:00
|
|
|
- name: Start MySQL
|
|
|
|
service:
|
|
|
|
name: mysql
|
|
|
|
state: started
|
|
|
|
enabled: true
|
2020-02-05 23:43:22 -06:00
|
|
|
- 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
|
2020-02-05 23:29:39 -06:00
|
|
|
become: true
|