Skip to content

Commit 324b789

Browse files
committed
Merge pull request geerlingguy#62 from stuwil/rhRootPassword
Set fact to check package installation regardless of distribution
2 parents 9e5e424 + d527fdc commit 324b789

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

tasks/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
- include: setup-Debian.yml
2626
when: ansible_os_family == 'Debian'
2727

28+
- name: Check if MySQL packages were installed.
29+
set_fact:
30+
mysql_install_packages: "{{ rh_mysql_install_packages.changed or deb_mysql_install_packages.changed }}"
31+
2832
# Configure MySQL.
2933
- include: configure.yml
3034
- include: secure-installation.yml

tasks/secure-installation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
mysql -u root -NBe
1212
'SET PASSWORD FOR "{{ mysql_root_username }}"@"{{ item }}" = PASSWORD("{{ mysql_root_password }}");'
1313
with_items: mysql_root_hosts.stdout_lines
14-
when: mysql_install_packages.changed or mysql_root_password_update
14+
when: mysql_install_packages | bool or mysql_root_password_update
1515

1616
# Has to be after the root password assignment, for idempotency.
1717
- name: Copy .my.cnf file with root password credentials.
@@ -35,4 +35,4 @@
3535
with_items: mysql_anonymous_hosts.stdout_lines
3636

3737
- name: Remove MySQL test database.
38-
mysql_db: "name='test' state=absent"
38+
mysql_db: "name='test' state=absent"

tasks/setup-Debian.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
- name: Ensure MySQL packages are installed.
1414
apt: "name={{ item }} state=installed"
1515
with_items: mysql_packages
16-
register: mysql_install_packages
16+
register: deb_mysql_install_packages
1717

1818
# Because Ubuntu starts MySQL as part of the install process, we need to stop
1919
# mysql and remove the logfiles in case the user set a custom log file size.

tasks/setup-RedHat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
- name: Ensure MySQL packages are installed.
66
yum: "name={{ item }} state=installed enablerepo={{ mysql_enablerepo }}"
77
with_items: mysql_packages
8-
register: mysql_install_packages
8+
register: rh_mysql_install_packages

0 commit comments

Comments
 (0)