Fix molecule verify

Make the output verbose and use bash shell.
This commit is contained in:
Faustin Lammler 2026-05-19 23:19:53 +02:00
parent e42c09c3c6
commit f66ecf1ea5
No known key found for this signature in database
GPG Key ID: 390A2F27832A5C79
4 changed files with 27 additions and 6 deletions

View File

@ -56,8 +56,8 @@ provisioner:
node3:
mariadb_server_id: 3
env:
ANSIBLE_DISPLAY_OK_HOSTS: "false"
ANSIBLE_DISPLAY_SKIPPED_HOSTS: false
ANSIBLE_EXECUTABLE: /bin/bash
ANSIBLE_FORCE_COLOR: true
ANSIBLE_GATHERING: explicit
ANSIBLE_ROLES_PATH: ../../..

View File

@ -22,12 +22,16 @@
tasks:
- name: Check that test db exist (created only on primary node)
ansible.builtin.shell: |
set -o errexit
set -o pipefail
mariadb -Bse 'SHOW DATABASES' | grep -q '^{{ item }}$'
loop:
- db
- name: Get replica status
ansible.builtin.shell: |
set -o errexit
set -o pipefail
mariadb -Bse 'SHOW SLAVE STATUS\G'
register: replica_status

View File

@ -13,8 +13,8 @@ platforms:
provisioner:
name: ansible
env:
ANSIBLE_DISPLAY_OK_HOSTS: "false"
ANSIBLE_DISPLAY_SKIPPED_HOSTS: false
ANSIBLE_EXECUTABLE: /bin/bash
ANSIBLE_FORCE_COLOR: true
ANSIBLE_GATHERING: explicit
ANSIBLE_ROLES_PATH: ../../..

View File

@ -49,26 +49,39 @@
ansible.builtin.wait_for:
port: 3306
timeout: 2
msg: "MariaDB is not listening on port 127.0.0.1:3306"
- name: Get MariaDB version
ansible.builtin.shell: |
set -o errexit
set -o pipefail
mariadb -Bse 'STATUS' | grep "^Server version:"
register: version
when: lookup('env', 'MARIADB_VERSION') is true
when: lookup('env', 'MARIADB_VERSION') != ""
- name: Show MariaDB version
ansible.builtin.debug:
msg: "{{ version.stdout }}"
when: lookup('env', 'MARIADB_VERSION') != ""
- name: Check MariaDB version
ansible.builtin.assert:
that:
- lookup('env', 'MARIADB_VERSION') in version.stdout
msg: "{{ version.stdout }}"
when: lookup('env', 'MARIADB_VERSION') is true
- "lookup('env', 'MARIADB_VERSION') in version.stdout"
fail_msg: "{{ version.stdout }}"
success_msg: "{{ version.stdout }}"
when: lookup('env', 'MARIADB_VERSION') != ""
- name: Check that Innodb engine is enabled (and default)
ansible.builtin.shell: |
set -o errexit
set -o pipefail
mariadb -Bse 'SHOW ENGINES' | grep -qE '^InnoDB.DEFAULT.*YES.YES.YES$'
- name: Check that default db exist
ansible.builtin.shell: |
set -o errexit
set -o pipefail
mariadb -Bse 'SHOW DATABASES' | grep -q '^{{ item }}$'
loop:
- mysql
@ -77,6 +90,8 @@
- name: Check that test db exist
ansible.builtin.shell: |
set -o errexit
set -o pipefail
mariadb -Bse 'SHOW DATABASES' | grep -q '^{{ item }}$'
loop:
- db1
@ -84,6 +99,8 @@
- name: Check that test users exist
ansible.builtin.shell: |
set -o errexit
set -o pipefail
mariadb -Bse 'SELECT user from mysql.user' | grep -q '^{{ item }}$'
loop:
- user1