--- # Copyright 2014, Rackspace US, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - name: Run mysql_upgrade block: - name: Fail if upgrade is needed ansible.builtin.command: /usr/bin/mariadb-upgrade --check-if-upgrade-is-needed register: galera_upgrade_check failed_when: galera_upgrade_check.rc == 0 changed_when: false rescue: - name: Run MySQL Upgrade ansible.builtin.command: /usr/bin/mariadb-upgrade register: galera_mysql_upgrade changed_when: - not galera_mysql_upgrade.stdout is search("already upgraded") until: galera_mysql_upgrade is success retries: 3 delay: 10 # NOTE(noonedeadpunk): We don't need to verify hostname when connectig to socket - name: Create galera users community.mysql.mysql_user: name: "{{ item.name }}" host: "{{ item.host }}" password: "{{ item.password }}" priv: "{{ item.priv }}" state: "{{ item.state }}" resource_limits: "{{ item.resource_limits | default(omit) }}" login_unix_socket: "{{ galera_unix_socket }}" check_hostname: false with_items: "{{ galera_setup_users }}" register: galera_users until: galera_users is success retries: 3 delay: 10 no_log: true