diff --git a/tests/roles/bootstrap-host/defaults/main.yml b/tests/roles/bootstrap-host/defaults/main.yml index 66700b973c..24c012595b 100644 --- a/tests/roles/bootstrap-host/defaults/main.yml +++ b/tests/roles/bootstrap-host/defaults/main.yml @@ -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 diff --git a/tests/roles/bootstrap-host/tasks/install_packages.yml b/tests/roles/bootstrap-host/tasks/install_packages.yml index 8a3784fd43..5eca876f84 100644 --- a/tests/roles/bootstrap-host/tasks/install_packages.yml +++ b/tests/roles/bootstrap-host/tasks/install_packages.yml @@ -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 diff --git a/tests/roles/bootstrap-host/templates/apt-sources.list.j2 b/tests/roles/bootstrap-host/templates/apt-sources.list.j2 index 8a632a1092..83afc4aa26 100644 --- a/tests/roles/bootstrap-host/templates/apt-sources.list.j2 +++ b/tests/roles/bootstrap-host/templates/apt-sources.list.j2 @@ -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 %}