--- - name: set fact tls_enabled command: "{{ mysql_command }} \"-e SHOW VARIABLES LIKE 'have_ssl';\"" register: result - set_fact: tls_enabled: "{{ 'YES' in result.stdout | bool | default('false', true) }}" - vars: mysql_parameters: &mysql_params login_user: '{{ mysql_user }}' login_password: '{{ mysql_password }}' login_host: '{{ mysql_host }}' login_port: '{{ mysql_primary_port }}' when: tls_enabled block: # ============================================================ - name: get server certificate copy: content: "{{ lookup('pipe', \"openssl s_client -starttls mysql -connect localhost:3307 -showcerts 2>/dev/null = 0.7.11 is required' in result.msg - name: Drop mysql user mysql_user: <<: *mysql_params name: '{{ user_name_1 }}' host: '{{ gateway_addr }}' state: absent