Jesse Pretorius 567b483efd Gate: Use OpenStack-CI apt mirrors
re: http://lists.openstack.org/pipermail/openstack-dev/2016-February/086295.html

OpenStack-CI has now implemented their own APT mirrors which are updated and
synchronised properly to prevent issues when the update takes place between
the time an instance does an 'apt-get update' and an 'apt-get install'.

Now that this infrastructure is in place, we can remove our logic to determine
the optimal apt source for gating and simply fall back to the default AIO
behaviour which is to use whatever is configured on the host.

In order to do this successfully the AIO needs to ensure that it has the
appropriate configurations in place to ignore unauthenticated packages.

This patch implements a full propogation of all files in
/etc/apt/apt.conf.d/ from the host to all containers in order to ensure
that any configurations implemented by OpenStack-Infra are used from
now on in our Gate jobs.

Change-Id: Id6c2be3cf57b7c49744156a943f9653c1575e3dd
2016-03-09 16:25:56 +00:00

110 lines
3.0 KiB
YAML

---
# Copyright 2015, 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 that apt supports HTTPS package sources
apt:
name: apt-transport-https
state: present
tags:
- apt-install-prerequisites
- name: Determine the list of apt configuration files on the host
command: "ls -1 /etc/apt/apt.conf.d"
register: apt_conf_files
tags:
- apt-conf-files
- name: Determine the existing Ubuntu repo configuration
shell: 'awk "/^deb .*ubuntu\/? {{ ansible_distribution_release }} main/ {print \$2; exit}" /etc/apt/sources.list'
register: ubuntu_repo
when:
- bootstrap_host_ubuntu_repo is not defined
changed_when: false
tags:
- find-apt-repo
- name: Determine the existing Ubuntu Security repo configuration
shell: 'awk "/^deb .*ubuntu\/? {{ ansible_distribution_release }}-security main/ {print \$2; exit}" /etc/apt/sources.list'
register: ubuntu_security_repo
when:
- bootstrap_host_ubuntu_security_repo is not defined
changed_when: false
tags:
- find-apt-security-repo
- name: Set apt repo facts based on discovered information
set_fact:
bootstrap_host_ubuntu_repo: "{{ ubuntu_repo.stdout }}"
bootstrap_host_ubuntu_security_repo: "{{ ubuntu_security_repo.stdout }}"
when:
- bootstrap_host_ubuntu_repo is not defined
- bootstrap_host_ubuntu_security_repo is not defined
- ubuntu_repo is defined
- ubuntu_security_repo is defined
- name: Configure apt's sources.list (Ubuntu only)
template:
src: apt-sources.list.j2
dest: /etc/apt/sources.list
backup: yes
when:
- ansible_distribution == 'Ubuntu'
- bootstrap_host_ubuntu_repo is defined
- bootstrap_host_ubuntu_security_repo is defined
register: apt_sources_configure
- name: Update apt-cache
apt:
update_cache: yes
when:
- apt_sources_configure is defined
- apt_sources_configure | changed
tags:
- apt-cache-update
- name: Remove known problem packages
apt:
name: "{{ item }}"
state: absent
with_items: packages_remove
tags:
- remove-packages
- name: Install required packages
apt:
name: "{{ item }}"
state: present
with_items: packages_install
tags:
- install-packages
- name: Install MongoDB packages
apt:
name: "{{ item }}"
state: present
with_items: packages_mongodb
when: bootstrap_host_mongodb_service | bool
tags:
- install-mongodb
- name: Install LibVirt packages
apt:
name: "{{ item }}"
state: present
with_items: packages_libvirt
when: bootstrap_host_libvirt_config | bool
tags:
- install-libvirt