mirror of
https://github.com/geerlingguy/ansible-role-apache
synced 2025-01-10 03:40:18 +01:00
Issue #60: Fix task that sets the new root user password.
This commit is contained in:
parent
b022e2699f
commit
f542bcfe73
1 changed files with 13 additions and 4 deletions
|
@ -4,13 +4,22 @@
|
||||||
register: mysql_root_hosts
|
register: mysql_root_hosts
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
|
# TODO: This is currently not idempotent.
|
||||||
- name: Update MySQL root password for localhost root account.
|
- name: Update MySQL root password for localhost root account.
|
||||||
mysql_user:
|
shell: >
|
||||||
name: "root"
|
mysql -u root -NBe
|
||||||
host: "{{ item }}"
|
'SET PASSWORD FOR "{{ mysql_root_username }}"@"{{ item }}" = PASSWORD("{{ mysql_root_password }}");'
|
||||||
password: "{{ mysql_root_password }}"
|
|
||||||
with_items: mysql_root_hosts.stdout_lines
|
with_items: mysql_root_hosts.stdout_lines
|
||||||
|
|
||||||
|
# The below task doesn't work in some instances for some users, at least with
|
||||||
|
# certain versions of Ansible.
|
||||||
|
# - name: Update MySQL root password for localhost root account.
|
||||||
|
# mysql_user:
|
||||||
|
# name: "{{ mysql_root_username }}"
|
||||||
|
# host: "{{ item }}"
|
||||||
|
# password: "{{ mysql_root_password }}"
|
||||||
|
# with_items: mysql_root_hosts.stdout_lines
|
||||||
|
|
||||||
# Has to be after the root password assignment, for idempotency.
|
# Has to be after the root password assignment, for idempotency.
|
||||||
- name: Copy .my.cnf file with root password credentials.
|
- name: Copy .my.cnf file with root password credentials.
|
||||||
template:
|
template:
|
||||||
|
|
Loading…
Reference in a new issue