Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for setting root password when running as local_action #28

Merged
merged 1 commit into from Apr 10, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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