
With ansible 2.2, apt_repository update_cache feature has been fixed. When a new repo will be added, apt-get update will be run after the addition if update_cache is set to yes. This combined with the apt module now properly checking the cache validity, we can now have proper updating of the cache with registering variables. Change-Id: I2b6b06e0986bc072758f2a5b4d692248143bd300
77 lines
2.2 KiB
YAML
77 lines
2.2 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.
|
|
|
|
# NOTE(cloudnull) This file can be removed when we drop 14.04 support
|
|
|
|
- name: Install haproxy pre packages
|
|
apt:
|
|
pkg: "{{ item }}"
|
|
state: "{{ haproxy_package_state }}"
|
|
update_cache: yes
|
|
cache_valid_time: "{{ cache_timeout }}"
|
|
register: install_packages
|
|
until: install_packages|success
|
|
retries: 5
|
|
delay: 2
|
|
with_items: "{{ haproxy_required_distro_packages }}"
|
|
tags:
|
|
- haproxy-pre-apt-packages
|
|
|
|
- name: Add haproxy 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
|
|
with_items: "{{ haproxy_gpg_keys }}"
|
|
tags:
|
|
- haproxy-apt-keys
|
|
|
|
- name: Add haproxy 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: "{{ haproxy_gpg_keys }}"
|
|
when: add_keys|failed and (item.fallback_keyserver is defined or item.fallback_url is defined)
|
|
tags:
|
|
- haproxy-apt-keys
|
|
|
|
- name: Add haproxy repo(s)
|
|
apt_repository:
|
|
repo: "{{ haproxy_repo.repo }}"
|
|
state: "{{ haproxy_repo.state }}"
|
|
update_cache: yes
|
|
when:
|
|
- haproxy_repo.repo is defined
|
|
- haproxy_repo.state is defined
|
|
register: add_repos
|
|
until: add_repos|success
|
|
retries: 5
|
|
delay: 2
|
|
tags:
|
|
- haproxy-repos
|