[Cleanup] Cleanup the mysql role

Remove the useless call for `cat` as `grep` take a file as it's second
argument that tell it to search for the pattern in a specific file
instead of whatever is passed to it through stdin.

Name both task defining the position of the config directory for
self-documentation purposes (and please ansible-lint defaults).

Change role description to it's description in the readme instead of the
default description asking for the role to be described.

Don't compare to empty string, an empty string is already false while a
non-empty string is true.
This commit is contained in:
Mathieu Trossevin 2020-06-18 15:53:52 +02:00
parent 66a6e67de2
commit 2036db938b
Signed by: mtrossevin
GPG key ID: 81987323AE7F3E99
7 changed files with 11 additions and 9 deletions

View file

@ -1,6 +1,6 @@
galaxy_info:
author: Evolix
description: your description
description: Install and configure mysql
issue_tracker_url: https://gitea.evolix.org/evolix/ansible-roles/issues

View file

@ -1,6 +1,7 @@
---
- set_fact:
- name: "Define the config directory of mysql"
set_fact:
mysql_config_directory: /etc/mysql/conf.d
- name: "Copy MySQL defaults config file (jessie)"

View file

@ -1,6 +1,7 @@
---
- set_fact:
- name: "Define the config directory of mysql"
set_fact:
mysql_config_directory: /etc/mysql/mariadb.conf.d
- name: "Copy MySQL defaults config file (Debian 9 or later)"

View file

@ -14,7 +14,7 @@
register: mysql_current_real_datadir_test
tags:
- mysql
when: mysql_custom_datadir != ''
when: mysql_custom_datadir
- block:
- name: MySQL is stopped
@ -40,6 +40,6 @@
tags:
- mysql
when:
- mysql_custom_datadir != ''
- mysql_custom_datadir
- mysql_custom_datadir != mysql_current_real_datadir_test.stdout
- not mysql_custom_datadir_test.stat.exists

View file

@ -14,7 +14,7 @@
register: mysql_current_real_logdir_test
tags:
- mysql
when: mysql_custom_logdir != ''
when: mysql_custom_logdir
- block:
- name: MySQL is stopped
@ -40,6 +40,6 @@
tags:
- mysql
when:
- mysql_custom_logdir != ''
- mysql_custom_logdir
- mysql_custom_logdir != mysql_current_real_logdir_test.stdout
- not mysql_custom_logdir_test.stat.exists

View file

@ -20,4 +20,4 @@
notify: "{{ mysql_restart_handler_name }}"
tags:
- mysql
when: mysql_custom_tmpdir != ''
when: mysql_custom_tmpdir

View file

@ -41,7 +41,7 @@
when: ansible_distribution_major_version is version('10', '>=')
- name: Read debian-sys-maint password
shell: 'cat /etc/mysql/debian.cnf | grep -m1 "password = .*" | cut -d" " -f3'
shell: 'grep -m1 "password = .*" /etc/mysql/debian.cnf | cut -d" " -f3'
register: mysql_debian_password
changed_when: False
check_mode: no