Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
Fixes geerlingguy#22: Make MySQL root user password settings more rel…
Browse files Browse the repository at this point in the history
…iable.
  • Loading branch information
geerlingguy committed Apr 9, 2015
1 parent 4b686f5 commit 3d0762b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions tasks/secure-installation.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
---
- name: Check if .my.cnf file already exists.
stat: "path={{ mysql_user_home }}/.my.cnf"
register: mycnf_file

# 'localhost' needs to be the last item for idempotency, see
# http://ansible.cc/docs/modules.html#mysql-user
- name: Update MySQL root password for all root accounts.
# 'localhost' needs to be last for idempotency.
- name: Update MySQL root password for localhost root account.
mysql_user:
name: "root"
host: "{{ item }}"
password: "{{ mysql_root_password }}"
with_items:
- "{{ ansible_hostname }}"
- 127.0.0.1
- ::1
- localhost
when: mycnf_file.stat.exists == false

# Has to be after the root password assignment, for idempotency.
- name: Copy .my.cnf file with root password credentials.
Expand Down

0 comments on commit 3d0762b

Please sign in to comment.