Created
May 12, 2016 03:46
-
-
Save wyattwalter/127e3ae7df9a6bf951d787d6cfdd8314 to your computer and use it in GitHub Desktop.
MySQL secure_installation using Ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: delete anonymous MySQL server user for {{ ansible_nodename }} | |
mysql_user: login_user=root | |
login_password='{{ mysql_root }}' | |
check_implicit_admin=yes | |
user="" | |
host={{ item }} | |
state="absent" | |
with_items: | |
- "" | |
- "{{ ansible_nodename }}" | |
- localhost | |
- name: Change root user password on first run | |
mysql_user: login_user=root | |
login_password="{{ mysql_root }}" | |
check_implicit_admin=yes | |
name=root | |
password={{ mysql_root }} | |
priv=*.*:ALL,GRANT | |
host={{ item }} | |
with_items: | |
- "{{ ansible_nodename }}" | |
- 127.0.0.1 | |
- ::1 | |
- localhost | |
- name: remove the MySQL test database | |
action: mysql_db login_user=root login_password="{{ mysql_root }}" db=test state=absent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment