Skip to content

Commit e27700b

Browse files
committed
Fix role failing in check mode
If the role is run in check mode, the shell commands never get executed and the variables used in the next task are undefined, causing the play to fail. The commands are now always executed to ensure the variables are populated.
1 parent b0fd5c3 commit e27700b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tasks/secure-installation.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
command: mysql -NBe 'SELECT Host FROM mysql.user WHERE User = "root" ORDER BY (Host="localhost") ASC'
1010
register: mysql_root_hosts
1111
changed_when: false
12+
always_run: true
1213

1314
# Note: We do not use mysql_user for this operation, as it doesn't always update
1415
# the root password correctly. See: https://goo.gl/MSOejW
@@ -32,6 +33,7 @@
3233
command: mysql -NBe 'SELECT Host FROM mysql.user WHERE User = ""'
3334
register: mysql_anonymous_hosts
3435
changed_when: false
36+
always_run: true
3537

3638
- name: Remove anonymous MySQL users.
3739
mysql_user:

0 commit comments

Comments
 (0)