mirror of
https://github.com/aljazceru/ansible-role-mysql.git
synced 2026-01-07 01:35:23 +01:00
Merge pull request #62 from stuwil/rhRootPassword
Set fact to check package installation regardless of distribution
This commit is contained in:
@@ -25,6 +25,10 @@
|
||||
- include: setup-Debian.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Check if MySQL packages were installed.
|
||||
set_fact:
|
||||
mysql_install_packages: "{{ rh_mysql_install_packages.changed or deb_mysql_install_packages.changed }}"
|
||||
|
||||
# Configure MySQL.
|
||||
- include: configure.yml
|
||||
- include: secure-installation.yml
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
mysql -u root -NBe
|
||||
'SET PASSWORD FOR "{{ mysql_root_username }}"@"{{ item }}" = PASSWORD("{{ mysql_root_password }}");'
|
||||
with_items: mysql_root_hosts.stdout_lines
|
||||
when: mysql_install_packages.changed or mysql_root_password_update
|
||||
when: mysql_install_packages | bool or mysql_root_password_update
|
||||
|
||||
# Has to be after the root password assignment, for idempotency.
|
||||
- name: Copy .my.cnf file with root password credentials.
|
||||
@@ -35,4 +35,4 @@
|
||||
with_items: mysql_anonymous_hosts.stdout_lines
|
||||
|
||||
- name: Remove MySQL test database.
|
||||
mysql_db: "name='test' state=absent"
|
||||
mysql_db: "name='test' state=absent"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
- name: Ensure MySQL packages are installed.
|
||||
apt: "name={{ item }} state=installed"
|
||||
with_items: mysql_packages
|
||||
register: mysql_install_packages
|
||||
register: deb_mysql_install_packages
|
||||
|
||||
# Because Ubuntu starts MySQL as part of the install process, we need to stop
|
||||
# mysql and remove the logfiles in case the user set a custom log file size.
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
- name: Ensure MySQL packages are installed.
|
||||
yum: "name={{ item }} state=installed enablerepo={{ mysql_enablerepo }}"
|
||||
with_items: mysql_packages
|
||||
register: mysql_install_packages
|
||||
register: rh_mysql_install_packages
|
||||
|
||||
Reference in New Issue
Block a user