Skip to content

Commit 9895a7b

Browse files
author
Colin Hoglund
committed
default with_items for conditional role includes and check mode
1 parent 2c6b9ef commit 9895a7b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

tasks/secure-installation.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
shell: >
2424
mysql -u root -NBe
2525
'ALTER USER "{{ mysql_root_username }}"@"{{ item }}" IDENTIFIED WITH mysql_native_password BY "{{ mysql_root_password }}";'
26-
with_items: "{{ mysql_root_hosts.stdout_lines }}"
26+
with_items: "{{ mysql_root_hosts.stdout_lines | default([]) }}"
2727
when: ((mysql_install_packages | bool) or mysql_root_password_update) and ('5.7.' in mysql_cli_version.stdout)
2828

2929
# Set root password for MySQL < 5.7.x.
3030
- name: Update MySQL root password for localhost root account (< 5.7.x).
3131
shell: >
3232
mysql -u root -NBe
3333
'SET PASSWORD FOR "{{ mysql_root_username }}"@"{{ item }}" = PASSWORD("{{ mysql_root_password }}");'
34-
with_items: "{{ mysql_root_hosts.stdout_lines }}"
34+
with_items: "{{ mysql_root_hosts.stdout_lines | default([]) }}"
3535
when: ((mysql_install_packages | bool) or mysql_root_password_update) and ('5.7.' not in mysql_cli_version.stdout)
3636

3737
# Has to be after the root password assignment, for idempotency.
@@ -54,7 +54,7 @@
5454
name: ""
5555
host: "{{ item }}"
5656
state: absent
57-
with_items: "{{ mysql_anonymous_hosts.stdout_lines }}"
57+
with_items: "{{ mysql_anonymous_hosts.stdout_lines | default([]) }}"
5858

5959
- name: Remove MySQL test database.
6060
mysql_db: "name='test' state=absent"

tasks/setup-Debian.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
- name: Ensure MySQL packages are installed.
1414
apt: "name={{ item }} state=installed"
15-
with_items: "{{ mysql_packages }}"
15+
with_items: "{{ mysql_packages | default([]) }}"
1616
register: deb_mysql_install_packages
1717

1818
# Because Ubuntu starts MySQL as part of the install process, we need to stop

tasks/setup-RedHat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
- name: Ensure MySQL packages are installed.
33
yum: "name={{ item }} state=installed enablerepo={{ mysql_enablerepo }}"
4-
with_items: "{{ mysql_packages }}"
4+
with_items: "{{ mysql_packages | default([]) }}"
55
register: rh_mysql_install_packages
66

77
- name: Ensure MySQL Python libraries are installed.

0 commit comments

Comments
 (0)