AIO: Provide facility to exclude apt distributions

When using a mirror which compiles all apt sources into
a single repo with the intent of relying on that repo for
all package updates the /etc/apt/sources.list file must
contain only the base ubuntu repo.

This patch adds the ability to implement an AIO with
this kind of apt sources configuration, while keeping
the current configuration that's used for gating.

Change-Id: Ia9785a43c9027df86f3bc94f825aba3c43a96e4c
This commit is contained in:
Jesse Pretorius 2017-03-07 12:51:49 +00:00 committed by Jesse Pretorius (odyssey4me)
parent 8187474644
commit ae6a0055d4
3 changed files with 25 additions and 9 deletions

View File

@ -196,6 +196,11 @@ bootstrap_host_data_disk_min_size: 50
#bootstrap_host_ubuntu_repo: http://archive.ubuntu.com/ubuntu/
#bootstrap_host_ubuntu_security_repo: http://archive.ubuntu.com/ubuntu/
# Set the distribution suffixes that will be included in the apt repository configuration
bootstrap_host_apt_distribution_suffix_list:
- updates
- backports
# Set the components that will be included in the apt repository configuration
bootstrap_host_apt_components:
- main

View File

@ -37,18 +37,24 @@
when:
- bootstrap_host_ubuntu_security_repo is not defined
changed_when: false
failed_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_lines[0] }}"
bootstrap_host_ubuntu_security_repo: "{{ ubuntu_security_repo.stdout_lines[0] }}"
when:
- bootstrap_host_ubuntu_repo is not defined
- bootstrap_host_ubuntu_security_repo is not defined
- ubuntu_repo is defined
- name: Set apt security repo facts based on discovered information
set_fact:
bootstrap_host_ubuntu_security_repo: "{{ ubuntu_security_repo.stdout_lines[0] }}"
when:
- bootstrap_host_ubuntu_security_repo is not defined
- ubuntu_security_repo is defined
- ubuntu_security_repo.stdout_lines | length > 0
- name: Configure apt's sources.list (Ubuntu only)
template:
@ -58,7 +64,6 @@
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

View File

@ -1,10 +1,16 @@
# {{ ansible_managed }}
# Base repositories
# Base repository
deb {{ bootstrap_host_ubuntu_repo }} {{ ansible_distribution_release }} {{ bootstrap_host_apt_components | join(" ") }}
# Updates repositories
deb {{ bootstrap_host_ubuntu_repo }} {{ ansible_distribution_release }}-updates {{ bootstrap_host_apt_components | join(" ") }}
# Backports repositories
deb {{ bootstrap_host_ubuntu_repo }} {{ ansible_distribution_release }}-backports {{ bootstrap_host_apt_components | join(" ") }}
# Security repositories
{% if bootstrap_host_apt_distribution_suffix_list | length > 0 %}
# Additional distribution repositories
{% for suffix in bootstrap_host_apt_distribution_suffix_list %}
deb {{ bootstrap_host_ubuntu_repo }} {{ ansible_distribution_release }}-{{ suffix }} {{ bootstrap_host_apt_components | join(" ") }}
{% endfor %}
{% endif %}
{% if bootstrap_host_ubuntu_security_repo is defined %}
# Security repository
deb {{ bootstrap_host_ubuntu_security_repo }} {{ ansible_distribution_release }}-security {{ bootstrap_host_apt_components | join(" ") }}
{% endif %}