Optimize container_cli usage by mysql-open-files-limit validation

mysql-open-files-limit could fail because Ansible fails to obtain
container_cli definition from inventory.

There are multiple playbooks that use container_cli to run
various commands. All playbooks but mysql-open-files-limit define
container_cli in different way. This patch aligns container_cli
definition and usage for mysql-open-files-limit validation with
other validations.

Change-Id: Ie957b9bb046e006be0e5cc56bd749a2fe67178e8
Closes-Bug: #1901299
Related: rhbz#1891202
(cherry picked from commit a2f5c55edb)
(cherry picked from commit bd800b9cbf)
This commit is contained in:
Alexey Stupnikov 2020-10-24 12:40:45 +02:00
parent 6de842a4f4
commit 02f3308bf4
1 changed files with 3 additions and 3 deletions

View File

@ -1,13 +1,13 @@
---
- name: Set container_cli fact from the inventory
set_fact:
container_cli: "{{ hostvars[inventory_hostname].container_cli }}"
container_cli: "{{ hostvars[inventory_hostname].container_cli |default('podman', true) }}"
- name: Get the open_files_limit value
become: true
shell: >-
"{{ container_cli|default('podman', true) }}" exec -u root
$("{{ container_cli|default('podman', true) }}" ps -q --filter "name=mysql|galera-bundle" | head -1)
"{{ container_cli }}" exec -u root
$("{{ container_cli }}" ps -q --filter "name=mysql|galera-bundle" | head -1)
/bin/bash -c 'ulimit -n'
changed_when: false
register: mysqld_open_files_limit