Skip to content

Commit

Permalink
Make use of fully-qualified collection name
Browse files Browse the repository at this point in the history
  • Loading branch information
tersmitten committed Sep 29, 2023
1 parent 4129ff1 commit c36d37a
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 94 deletions.
3 changes: 2 additions & 1 deletion requirements.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# requirements file
---
collections: []
collections:
- name: community.mysql
20 changes: 13 additions & 7 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: get mysql version

Check warning on line 3 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 3 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

risky-shell-pipe

Shells that use pipes should set the pipefail option.
shell: >
ansible.builtin.shell: >
mysqld --version | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9][^.]\).*/\1/p'
register: _mysql_version
changed_when: false
Expand All @@ -11,7 +11,8 @@
- percona-server-tools
- percona-server-tools-get-mysql-version

- include: reset-root-password-lt-57.yml
- name: reset root password < 5.7

Check warning on line 14 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.import_tasks: reset-root-password-lt-57.yml
when:
- percona_server_tools_reset_root_password.run | default(false)
- _mysql_version.stdout is version('5.7', '<')
Expand All @@ -22,7 +23,8 @@
- percona-server-tools-reset-root-password
- percona-server-tools-reset-root-password-lt-57

- include: reset-root-password-ge-57.yml
- name: reset root password >= 5.7

Check warning on line 26 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.import_tasks: reset-root-password-ge-57.yml
when:
- percona_server_tools_reset_root_password.run | default(false)
- _mysql_version.stdout is version('5.7', '>=')
Expand All @@ -33,31 +35,35 @@
- percona-server-tools-reset-root-password
- percona-server-tools-reset-root-password-ge-57

- include: reset-ib-logfile.yml
- name: reset ib_logfile

Check warning on line 38 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.import_tasks: reset-ib-logfile.yml
when: percona_server_tools_reset_ib_logfile.run | default(false)
tags:
- configuration
- tools
- percona-server-tools
- percona-server-tools-reset-ib-logfile

- include: setup-slave-replication.yml
- name: setup slave replication

Check warning on line 47 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.import_tasks: setup-slave-replication.yml
when: percona_server_tools_setup_slave_replication.run | default(false)
tags:
- configuration
- tools
- percona-server-tools
- percona-server-tools-setup-slave-replication

- include: setup-slave-replication-gtid.yml
- name: setup slave replication gtid

Check warning on line 56 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.import_tasks: setup-slave-replication-gtid.yml
when: percona_server_tools_setup_slave_replication_gtid.run | default(false)
tags:
- configuration
- tools
- percona-server-tools
- percona-server-tools-setup-slave-replication-gtid

- include: setup-master-replication.yml
- name: setup master replication

Check warning on line 65 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.import_tasks: setup-master-replication.yml
when: percona_server_tools_setup_master_replication.run | default(false)
tags:
- configuration
Expand Down
14 changes: 7 additions & 7 deletions tasks/reset-ib-logfile.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
# tasks file
---
- name: reset ib logfile | get InnoDB shutdown mode

Check warning on line 3 in tasks/reset-ib-logfile.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
mysql_variables:
community.mysql.mysql_variables:
variable: innodb_fast_shutdown
register: _innodb_fast_shutdown_value
when: percona_server_tools_reset_ib_logfile.check_innodb_shutdown_mode | default(true)
tags:
- percona-server-tools-reset-ib-logfile-check-innodb-shutdown-mode

- name: reset ib logfile | store InnoDB shutdown mode (as fact)
set_fact:
ansible.builtin.set_fact:
percona_server_tools_innodb_fast_shutdown: "{{ _innodb_fast_shutdown_value.msg }}"
tags:
- percona-server-tools-reset-ib-logfile-check-innodb-shutdown-mode

- name: reset ib logfile | set InnoDB shutdown mode
mysql_variables:
community.mysql.mysql_variables:
variable: innodb_fast_shutdown
value: "1"
when: percona_server_tools_reset_ib_logfile.check_innodb_shutdown_mode | default(true)
tags:
- percona-server-tools-reset-ib-logfile-set-innodb-shutdown-mode

- name: reset ib logfile | stop service
service:
ansible.builtin.service:
name: mysql
state: stopped
tags:
- percona-server-tools-reset-ib-logfile-stop-service

- name: reset ib logfile | remove ib_logfile(s)
file:
ansible.builtin.file:
path: "{{ item }}"
state: absent
with_items: "{{ percona_server_tools_reset_ib_logfile.ib_logfiles | default(['/var/lib/mysql/ib_logfile0', '/var/lib/mysql/ib_logfile1']) }}"
tags:
- percona-server-tools-reset-ib-logfile-remove

- name: reset ib logfile | start service
service:
ansible.builtin.service:
name: mysql
state: started
tags:
- percona-server-tools-reset-ib-logfile-start-service

- name: reset ib logfile | restore InnoDB shutdown mode
mysql_variables:
community.mysql.mysql_variables:
variable: innodb_fast_shutdown
value: "{{ percona_server_tools_innodb_fast_shutdown }}"
when: percona_server_tools_reset_ib_logfile.check_innodb_shutdown_mode | default(true)
Expand Down
16 changes: 8 additions & 8 deletions tasks/reset-root-password-ge-57.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# tasks file
---
- name: reset root password | stop service
service:
ansible.builtin.service:
name: mysql
state: stopped
tags:
- percona-server-tools-reset-root-password-ge-57-stop-service

- name: reset root password | create init-file
copy:
ansible.builtin.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';
Expand All @@ -21,15 +21,15 @@
- percona-server-tools-reset-root-password-ge-57-init-file-create

- name: reset root password | copy my.cnf
command: >
ansible.builtin.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:
ansible.builtin.lineinfile:
path: "{{ percona_server_tools_my_cnf_file_safe }}"
state: absent
regexp: "{{ item }}"
Expand All @@ -38,7 +38,7 @@
- percona-server-tools-reset-root-password-ge-57-my-cnf-safe

- name: reset root password | start service without grants and networking
command: >
ansible.builtin.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 }}
Expand All @@ -53,7 +53,7 @@
- percona-server-tools-reset-root-password-ge-57-start-service

- name: reset root password | wait for service to finish
async_status:
ansible.builtin.async_status:
jid: "{{ _mysqld_sleeper.ansible_job_id }}"
register: _mysqld_sleeper_result
until: _mysqld_sleeper_result.finished
Expand All @@ -63,7 +63,7 @@
- percona-server-tools-reset-root-password-ge-57-end-service

- name: reset root password | cleanup tmp files
file:
ansible.builtin.file:
path: "{{ item }}"
state: absent
with_items:
Expand All @@ -73,7 +73,7 @@
- percona-server-tools-reset-root-password-ge-57-cleanup

- name: reset root password | start service
service:
ansible.builtin.service:
name: mysql
state: started
tags:
Expand Down
6 changes: 3 additions & 3 deletions tasks/reset-root-password-lt-57.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# tasks file
---
- name: reset root password | flush privileges
command: >
ansible.builtin.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: >
ansible.builtin.command: >
mysql
--defaults-file=/etc/mysql/debian.cnf
--database=mysql
Expand All @@ -20,7 +20,7 @@
- percona-server-tools-reset-root-password-lt-57-update-password

- name: reset root password | flush privileges
command: >
ansible.builtin.command: >
mysql --defaults-file=/etc/mysql/debian.cnf --database=mysql -e "FLUSH PRIVILEGES;"
changed_when: false
tags:
Expand Down
Loading

0 comments on commit c36d37a

Please sign in to comment.