86 lines
2.7 KiB
YAML
86 lines
2.7 KiB
YAML
---
|
|
# Copyright 2016, 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.
|
|
|
|
# Unfortunately yum is case-insensitive, and RDO has mariadb-* packages,
|
|
# while the MariaDB repo has MariaDB-* packages and they conflict.
|
|
# To work around this we have to query for any installed RDO/CentOS
|
|
# packages using rpm, then remove them. We have to remove them without
|
|
# dependencies, otherwise for distro package installation types on shared
|
|
# hosts it removes far too many packages.
|
|
- name: Remove conflicting packages
|
|
shell: |
|
|
exit_code=0
|
|
for pkg in {{ galera_client_distro_remove_packages | join(' ') }}; do
|
|
if rpm --query --quiet ${pkg}; then
|
|
rpm -ev --nodeps ${pkg}
|
|
exit_code=2
|
|
fi
|
|
done
|
|
exit ${exit_code}
|
|
register: _remove_existing_mariadb_packages
|
|
changed_when: _remove_existing_mariadb_packages.rc == 2
|
|
failed_when: _remove_existing_mariadb_packages.rc not in [0, 2]
|
|
args:
|
|
warn: no
|
|
executable: /bin/bash
|
|
|
|
- name: If a keyfile is provided, copy the gpg keyfile to the key location
|
|
copy:
|
|
src: "gpg/{{ item.key | basename }}"
|
|
dest: "{{ item.key }}"
|
|
mode: '0644'
|
|
with_items: "{{ galera_client_gpg_keys }}"
|
|
tags:
|
|
- galera-gpg-keys
|
|
|
|
- name: Install gpg keys
|
|
rpm_key: "{{ key }}"
|
|
with_items: "{{ galera_client_gpg_keys }}"
|
|
loop_control:
|
|
loop_var: key
|
|
register: _add_yum_keys
|
|
until: _add_yum_keys is success
|
|
retries: 5
|
|
delay: 2
|
|
tags:
|
|
- galera-gpg-keys
|
|
|
|
- name: Add galera repo
|
|
yum_repository:
|
|
name: "{{ item.name }}"
|
|
description: "{{ item.description }}"
|
|
baseurl: "{{ item.baseurl }}"
|
|
gpgkey: "{{ item.gpgkey | default(omit) }}"
|
|
gpgcheck: yes
|
|
enabled: yes
|
|
register: add_repos
|
|
until: add_repos is success
|
|
retries: 5
|
|
delay: 2
|
|
with_items:
|
|
- "{{ galera_client_repo }}"
|
|
tags:
|
|
- galera-repos
|
|
|
|
# NOTE(hwoarang): MariaDB repository is prioritized at 99 by default
|
|
# and that allows yum to install mariadb client from the RDO repos, which
|
|
# is not good. This task ensures that the following tasks will choose
|
|
# MariaDB repo as the highest priority.
|
|
- name: Ensure MariaDB repository takes highest priority
|
|
command: |
|
|
yum-config-manager
|
|
--enable MariaDB
|
|
--setopt="MariaDB.priority=25"
|