We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3d0762b + 0fbf3fa commit 364cb3eCopy full SHA for 364cb3e
tasks/secure-installation.yml
@@ -1,15 +1,16 @@
1
---
2
+- name: Get list of hosts for root user
3
+ command: mysql -NBe 'SELECT Host from mysql.user WHERE User = "root" order by (Host="localhost") ASC'
4
+ register: mysql_root_hosts
5
+ changed_when: false
6
+
7
# 'localhost' needs to be last for idempotency.
8
- name: Update MySQL root password for localhost root account.
9
mysql_user:
10
name: "root"
11
host: "{{ item }}"
12
password: "{{ mysql_root_password }}"
- with_items:
- - "{{ ansible_hostname }}"
- - 127.0.0.1
- - ::1
- - localhost
13
+ with_items: mysql_root_hosts.stdout_lines
14
15
# Has to be after the root password assignment, for idempotency.
16
- name: Copy .my.cnf file with root password credentials.
0 commit comments