|
|
@ -26,8 +26,16 @@ |
|
|
|
- name: Start the mysql services Redhat |
|
|
|
service: name={{ mysql_service }} state=started enabled=yes |
|
|
|
|
|
|
|
- name: generate a new random mysql root passwrod |
|
|
|
gen_passwd: length=16 |
|
|
|
register: random_root_pass |
|
|
|
when: mysql_root_db_pass is not defined |
|
|
|
|
|
|
|
- debug: |
|
|
|
var: random_root_pass.passwd |
|
|
|
|
|
|
|
- name: update mysql root password for all root accounts |
|
|
|
mysql_user: name=root host={{ item }} password={{ mysql_root_db_pass }} |
|
|
|
mysql_user: name=root host={{ item }} password={{ mysql_root_db_pass | default(random_root_pass.passwd) }} |
|
|
|
with_items: |
|
|
|
- "{{ ansible_hostname }}" |
|
|
|
- 127.0.0.1 |
|
|
@ -36,7 +44,7 @@ |
|
|
|
when: ansible_hostname != 'localhost' |
|
|
|
|
|
|
|
- name: update mysql root password for all root accounts |
|
|
|
mysql_user: name=root host={{ item }} password={{ mysql_root_db_pass }} |
|
|
|
mysql_user: name=root host={{ item }} password={{ mysql_root_db_pass | default(random_root_pass.passwd) }} |
|
|
|
with_items: |
|
|
|
- 127.0.0.1 |
|
|
|
- ::1 |
|
|
|