openstack-ansible-pip_install/tasks/pre_install_apt.yml

73 lines
2.1 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.
- name: Ensure apt cache is up to date
apt:
update_cache: yes
cache_valid_time: "{{ cache_timeout }}"
# Under Ubuntu, this will only add the key
- name: Install UCA repository key
apt:
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
- name: Install UCA repository
apt_repository:
repo: "{{ uca_repo }}"
state: present
update_cache: yes
filename: "{{ uca_apt_source_list_filename | default(omit) }}"
register: uca_add_repo
until: uca_add_repo|success
retries: 5
delay: 2
when:
- uca_enable
tags:
- add-uca-repo
- name: Install external repo key manually (apt)
apt_key:
id: "{{ item.id | default(omit) }}"
keyserver: "{{ item.keyserver | default(omit) }}"
url: "{{ item.url | 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 }}"
tags:
- add-repo-keys
- name: Install external repo manually (apt)
apt_repository:
repo: "{{ item.repo }}"
state: "{{ item.state | default('present') }}"
update_cache: yes
filename: "{{ item.filename | default(omit) }}"
register: use_external_repo_apt
until: use_external_repo_apt|success
retries: 5
delay: 2
with_items: "{{ user_external_repos_list }}"
tags:
- add-external-repo