-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from Oefenweb/ANSPB-354-adjust-ansible-percona…
…-server- WIP - Adjust role to be 5.7 compatible
- Loading branch information
Showing
6 changed files
with
144 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# tasks file for percona-server-tools | ||
--- | ||
- name: reset root password | stop service | ||
service: | ||
name: mysql | ||
state: stopped | ||
tags: | ||
- percona-server-tools-reset-root-password-ge-57-stop-service | ||
|
||
- name: reset root password | create init-file | ||
copy: | ||
dest: "{{ percona_server_tools_my_init_file }}" | ||
content: | | ||
UPDATE `mysql`.`user` SET `authentication_string` = PASSWORD('{{ percona_server_tools_reset_root_password.root_password }}'), plugin = 'mysql_native_password' WHERE `User` = 'root'; | ||
FLUSH PRIVILEGES; | ||
owner: root | ||
group: "{{ percona_server_tools_mysqld_user }}" | ||
mode: 0640 | ||
force: true | ||
tags: | ||
- percona-server-tools-reset-root-password-ge-57-init-file-create | ||
|
||
- name: reset root password | copy my.cnf | ||
command: > | ||
cp -av {{ percona_server_tools_my_cnf_file }} {{ percona_server_tools_my_cnf_file_safe }} | ||
register: _my_cnf_copy | ||
changed_when: _my_cnf_copy.stdout_lines | length > 0 | ||
tags: | ||
- percona-server-tools-reset-root-password-ge-57-my-cnf-copy | ||
|
||
- name: reset root password | make my.cnf safe | ||
lineinfile: | ||
path: "{{ percona_server_tools_my_cnf_file_safe }}" | ||
state: absent | ||
regexp: "{{ item }}" | ||
with_items: "{{ percona_server_tools_reset_root_password.unsafe_variables | default([]) }}" | ||
tags: | ||
- percona-server-tools-reset-root-password-ge-57-my-cnf-safe | ||
|
||
- name: reset root password | start service without grants and networking | ||
command: > | ||
timeout --preserve-status {{ percona_server_tools_mysqld_start_timeout }}s mysqld \ | ||
--defaults-file={{ percona_server_tools_my_cnf_file_safe }} \ | ||
--init-file={{ percona_server_tools_my_init_file }} \ | ||
--skip-grant-tables \ | ||
--skip-networking \ | ||
--user="{{ percona_server_tools_mysqld_user }}" | ||
async: "{{ (percona_server_tools_mysqld_start_timeout | int) * 10 }}" | ||
poll: 0 | ||
register: _mysqld_sleeper | ||
changed_when: false | ||
tags: | ||
- percona-server-tools-reset-root-password-ge-57-start-service | ||
|
||
- name: reset root password | wait for service to finish | ||
async_status: | ||
jid: "{{ _mysqld_sleeper.ansible_job_id }}" | ||
register: _mysqld_sleeper_result | ||
until: _mysqld_sleeper_result.finished | ||
retries: "{{ (percona_server_tools_mysqld_start_timeout | int) * 10 }}" | ||
delay: 1 | ||
tags: | ||
- percona-server-tools-reset-root-password-ge-57-end-service | ||
|
||
- name: reset root password | cleanup tmp files | ||
file: | ||
path: "{{ item }}" | ||
state: absent | ||
with_items: | ||
- "{{ percona_server_tools_my_cnf_file_safe }}" | ||
- "{{ percona_server_tools_my_init_file }}" | ||
tags: | ||
- percona-server-tools-reset-root-password-ge-57-cleanup | ||
|
||
- name: reset root password | start service | ||
service: | ||
name: mysql | ||
state: started | ||
tags: | ||
- percona-server-tools-reset-root-password-ge-57-start-service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# tasks file for percona-server-tools | ||
--- | ||
- name: reset root password | flush privileges | ||
command: > | ||
mysql --defaults-file=/etc/mysql/debian.cnf --database=mysql -e "FLUSH PRIVILEGES;" | ||
changed_when: false | ||
tags: | ||
- percona-server-tools-reset-root-password-lt-57-flush-privileges | ||
|
||
- name: reset root password | login as debian-sys-maint and reset root password | ||
command: > | ||
mysql \ | ||
--defaults-file=/etc/mysql/debian.cnf \ | ||
--database=mysql \ | ||
-e "UPDATE `user` SET `Password` = PASSWORD('{{ percona_server_tools_reset_root_password.root_password }}') WHERE `User` = 'root'; SELECT ROW_COUNT();" \ | ||
--skip-column-names | ||
register: _rows_affected | ||
changed_when: "_rows_affected.stdout != '0'" | ||
tags: | ||
- percona-server-tools-reset-root-password-lt-57-update-password | ||
|
||
- name: reset root password | flush privileges | ||
command: > | ||
mysql --defaults-file=/etc/mysql/debian.cnf --database=mysql -e "FLUSH PRIVILEGES;" | ||
changed_when: false | ||
tags: | ||
- percona-server-tools-reset-root-password-lt-57-flush-privileges |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
# vars file for percona-server-tools | ||
--- | ||
percona_server_tools_ulimit: 65535 | ||
|
||
percona_server_tools_my_init_file: /etc/mysql/my.init | ||
percona_server_tools_my_cnf_file: /etc/mysql/my.cnf | ||
percona_server_tools_my_cnf_file_safe: "{{ percona_server_tools_my_cnf_file }}-safe" | ||
|
||
percona_server_tools_preset_query_response_time_variables: '^query_response_time_' | ||
|
||
percona_server_tools_mysqld_user: mysql | ||
percona_server_tools_mysqld_start_timeout: 30 |