openstack-ansible-pip_install/tasks/pre_install_yum.yml

76 lines
2.7 KiB
YAML

---
# Copyright 2017, 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.
# Under CentOS, this will add the repo and its key to the keyring
- name: Install RDO repository and key
yum:
name: "{{ pip_install_external_repo_key_package }}"
state: "{{ pip_install_external_repo_key_package_state | default('present') }}"
when:
- user_external_repo_key is not defined
tags:
- add-repo-keys
# NOTE: All yum repositories are priority 99 (lowest possible) by default.
# EPEL and RDO have packages that conflict (especially with RabbitMQ's
# Erlang dependencies). This task ensures that RDO is always preferred
# over EPEL when both are configured.
# TODO(mhayden): If the yum_repository module is improved to allow for edits to
# existing repository files, this task should be updated to use
# yum_repository instead of ini_file.
# Ansible bug: https://github.com/ansible/ansible/issues/22362
- name: Increase priority for RDO repository
ini_file:
dest: "{{ item.path }}"
section: "{{ item.section }}"
option: priority
value: 50
with_items:
- { path: "/etc/yum.repos.d/rdo-release.repo", section: "openstack-ocata" }
- { path: "/etc/yum.repos.d/rdo-qemu-ev.repo", section: "rdo-qemu-ev"}
- name: Install external repo key manually
rpm_key:
key: "{{ item.key }}"
validate_certs: "{{ item.validate_certs | default(omit) }}"
state: "{{ item.state | default('present') }}"
register: add_keys
until: add_keys|success
retries: 5
delay: 2
with_items: "{{ user_external_repo_keys_list }}"
when:
- user_external_repo_keys_list is defined
tags:
- add-repo-keys
- name: Install external repo manually
yum_repository:
name: "{{ item.name }}"
description: "{{ item.description | default(omit) }}"
baseurl: "{{ item.baseurl | default(omit) }}"
gpgkey: "{{ item.gpgkey | default(omit) }}"
gpgcheck: "{{ item.gpgcheck | default(omit) }}"
enabled: "{{ item.enabled | default('yes') }}"
register: use_external_repo_yum
until: use_external_repo_yum|success
retries: 5
delay: 2
with_items: "{{ user_external_repos_list }}"
when:
- user_external_repos_list is defined
tags:
- add-external-repo