diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9cf5c7fb24c53b272f379bd0aa8ebc00445129a4..594791bd6de76f5327e4e80980de3b87744aee8b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,19 +17,19 @@ repos: name: YAML Lint # https://github.com/ansible/ansible-lint/releases - repo: https://github.com/ansible/ansible-lint.git - rev: v6.20.3 + rev: v6.21.1 hooks: - id: ansible-lint name: Ansible Lint language: python additional_dependencies: # https://github.com/kellyjonbrazil/jc/releases - - jc==1.23.4 + - jc==1.23.6 # https://github.com/jmespath/jmespath.py/tags - jmespath==1.0.1 # https://github.com/jackdewinter/pymarkdown/releases - repo: https://github.com/jackdewinter/pymarkdown.git - rev: v0.9.13.4 + rev: v0.9.14 hooks: - id: pymarkdown name: Markdown Lint diff --git a/README.md b/README.md index 322edfed48a920fb16483624bc8d41b7517fcd66..12d4fb79fab558713dc13a026ce6a7ed50f74a57 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,12 @@ mariadb_config: default_character_set: utf8mb4 ``` +You can get the existing configuration as YAML using: + +```bash +cat /etc/mysql/mariadb.conf.d/50-server.cnf | jc --ini -p | yq -o=yaml -P +``` + ### mariadb_mysqltuner A boolean, `mariadb_mysqltuner` defaults to `true` and results in [MySQLTuner](https://github.com/major/MySQLTuner-perl) being installed using a Debian package or from GitHub depending on the version specified using `mariadb_mysqltuner_version`. diff --git a/tasks/mysqltuner.yml b/tasks/mysqltuner.yml index 8f4c1d158102a4ebf58a76782af29d9af7bc4ea1..cc1372ddedc0e124bcb40318c0f0a9ec2e93fd63 100644 --- a/tasks/mysqltuner.yml +++ b/tasks/mysqltuner.yml @@ -147,6 +147,11 @@ depth: 1 update: true + - name: Check that MySQLTuner code is present + ansible.builtin.stat: + path: /usr/local/src/MySQLTuner-perl/mysqltuner.pl + register: mariadb_mysqltuner_script + - name: MySQLTuner script in place ansible.builtin.copy: src: /usr/local/src/MySQLTuner-perl/mysqltuner.pl @@ -155,6 +160,7 @@ mode: "0755" owner: root group: root + when: mariadb_mysqltuner_script.stat.exists | bool - name: Directory for MySQLTuner assets in place ansible.builtin.file: @@ -164,6 +170,11 @@ owner: root group: root + - name: Check that MySQLTuner passwords is present + ansible.builtin.stat: + path: /usr/local/src/MySQLTuner-perl/basic_passwords.txt + register: mariadb_mysqltuner_passwords + - name: MySQLTuner basic_passwords.txt file in place ansible.builtin.copy: src: /usr/local/src/MySQLTuner-perl/basic_passwords.txt @@ -172,6 +183,12 @@ mode: "0644" owner: root group: root + when: mariadb_mysqltuner_passwords.stat.exists | bool + + - name: Check that MySQLTuner vulnerabilities is present + ansible.builtin.stat: + path: /usr/local/src/MySQLTuner-perl/vulnerabilities.csv + register: mariadb_mysqltuner_vulnerabilities - name: MySQLTuner vulnerabilities.csv file in place ansible.builtin.copy: @@ -181,6 +198,7 @@ mode: "0644" owner: root group: root + when: mariadb_mysqltuner_vulnerabilities.stat.exists | bool when: >- ( ansible_local.dpkg.installed is not defined ) or