Skip to content

Commit 4eaae0e

Browse files
committed
Update MySQL password setting to work a little better.
1 parent fbb164e commit 4eaae0e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tasks/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
state=started
3434
enabled=yes
3535
36+
- name: Check if .my.cnf file already exists.
37+
stat: "path={{ mysql_user_home }}/.my.cnf"
38+
register: mycnf_file
39+
3640
# 'localhost' needs to be the last item for idempotency, see
3741
# http://ansible.cc/docs/modules.html#mysql-user
3842
- name: Update MySQL root password for all root accounts.
@@ -44,6 +48,7 @@
4448
- 127.0.0.1
4549
- ::1
4650
- localhost
51+
when: mycnf_file.stat.exists == false
4752

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

0 commit comments

Comments
 (0)