openstack-ansible-rabbitmq_.../tasks/install_apt.yml
Jean-Philippe Evrard 4dd1ca8a29 Allow definition of repo filename
If a deployer wants to co-locate his rabbitmq mirror with another
content in the same repo, (s)he probably also wants to define the same
repo filename, to avoid clashes.

This commit brings this feature optionally, and follows the same
pattern as other roles.

Change-Id: Id4d2198eebf05a8dc48949e4a129491c75037c79
2017-01-19 10:22:47 +00:00

99 lines
2.9 KiB
YAML

---
# 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: Install RabbitMQ package dependencies
apt:
pkg: "{{ item }}"
state: "{{ rabbitmq_package_state }}"
update_cache: yes
cache_valid_time: "{{ cache_timeout }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ rabbitmq_dependencies | deprecated(rabbitmq_apt_packages, 'rabbitmq_apt_packages', 'rabbitmq_dependencies', 'Ocata') }}"
tags:
- rabbitmq-apt-packages
- name: Add rabbitmq apt-keys
apt_key:
id: "{{ item.hash_id }}"
keyserver: "{{ item.keyserver | default(omit) }}"
data: "{{ item.data | default(omit) }}"
url: "{{ item.url | default(omit) }}"
state: "present"
register: add_keys
until: add_keys|success
failed_when: false
retries: 5
delay: 2
when: rabbitmq_install_method == 'external_repo'
with_items: "{{ rabbitmq_gpg_keys }}"
tags:
- rabbitmq-apt-keys
- name: Add rabbitmq apt-keys using fallback keyserver
apt_key:
id: "{{ item.hash_id }}"
keyserver: "{{ item.fallback_keyserver | default(omit) }}"
url: "{{ item.fallback_url | default(omit) }}"
state: "present"
register: add_keys_fallback
until: add_keys_fallback|success
retries: 5
delay: 2
with_items: "{{ rabbitmq_gpg_keys }}"
when:
- rabbitmq_install_method == 'external_repo'
- add_keys|failed
- (item.fallback_keyserver is defined or item.fallback_url is defined)
tags:
- rabbitmq-apt-keys
- name: Add rabbitmq repo
apt_repository:
repo: "{{ rabbitmq_repo.repo }}"
state: "{{ rabbitmq_repo.state }}"
filename: "{{ rabbitmq_repo.filename | default(omit) }}"
register: add_repos
until: add_repos|success
retries: 5
delay: 2
when: rabbitmq_install_method == 'external_repo'
tags:
- rabbitmq-repos
- name: Install the RabbitMQ package through a deb file
apt:
deb: "{{ rabbitmq_package_path }}"
register: install_rabbitmq
when: rabbitmq_install_method == 'file'
tags:
- rabbitmq-package-deb
- rabbitmq-apt-packages
- name: Install RabbitMQ packages
package:
name: "{{ item }}"
state: "{{ rabbitmq_package_state }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ rabbitmq_distro_packages }}"
when: rabbitmq_install_method != 'file'
tags:
- rabbitmq-apt-packages