Skip to content

Commit

Permalink
Merge pull request #28 from BlackMesh/local-action-password
Browse files Browse the repository at this point in the history
#28 Make root password configuration more flexible, able to work with local_action
  • Loading branch information
geerlingguy committed Apr 10, 2015
2 parents 3d0762b + 0fbf3fa commit 364cb3e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tasks/secure-installation.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
---
- name: Get list of hosts for root user
command: mysql -NBe 'SELECT Host from mysql.user WHERE User = "root" order by (Host="localhost") ASC'
register: mysql_root_hosts
changed_when: false

# 'localhost' needs to be last for idempotency.
- name: Update MySQL root password for localhost root account.
mysql_user:
name: "root"
host: "{{ item }}"
password: "{{ mysql_root_password }}"
with_items:
- "{{ ansible_hostname }}"
- 127.0.0.1
- ::1
- localhost
with_items: mysql_root_hosts.stdout_lines

# Has to be after the root password assignment, for idempotency.
- name: Copy .my.cnf file with root password credentials.
Expand Down

0 comments on commit 364cb3e

Please sign in to comment.