From 9c74fead0e273d77fb53b65df7e6118fdd1de4dd Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 10 Aug 2017 11:26:44 +0100 Subject: [PATCH] Use LXC reverse proxy and improve UCA repo discovery This patch implements the use of the images.linuxcontainers.org reverse proxy when in nodepool, and also improves the discovery of the UCA repo URL so that it's done in the way that infra expects it to be done. The lxc_container_template_main_apt_repo and lxc_container_template_security_apt_rep fact overrides are removed as they serve no purpose any more. Those vars were removed in Newton. Depends-On: Ia6b149f157e5697d36fdea3dc65cb2ac4815a1a4 Change-Id: I0e27abaea4cac010e9ecdae4dcb1d6cb83ad9d29 --- common-tasks/test-set-nodepool-vars.yml | 51 ++++++++++++++++--------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/common-tasks/test-set-nodepool-vars.yml b/common-tasks/test-set-nodepool-vars.yml index 87237008..2bb9d2bd 100644 --- a/common-tasks/test-set-nodepool-vars.yml +++ b/common-tasks/test-set-nodepool-vars.yml @@ -19,20 +19,45 @@ register: nodepool delegate_to: localhost -- name: Determine the existing Ubuntu repo URL - shell: 'awk "/^deb .*ubuntu\/? {{ ansible_distribution_release }} main/ {print \$2; exit}" /etc/apt/sources.list' - register: ubuntu_repo_url - changed_when: false +- name: Discover the lxc_image_cache_server value when in nodepool + shell: | + source /etc/ci/mirror_info.sh + echo "${NODEPOOL_MIRROR_HOST}:8080/images.linuxcontainers" + args: + executable: /bin/bash + register: lxc_reverse_proxy + delegate_to: localhost + when: + - nodepool.stat.exists | bool + tags: + - skip_ansible_lint + +- name: Set a fact to override lxc_image_cache_server value when in nodepool + set_fact: + lxc_image_cache_server: "{{ lxc_reverse_proxy.stdout }}" + when: + - nodepool.stat.exists | bool + +- name: Discover the UCA repo URL value when in nodepool + shell: | + source /etc/ci/mirror_info.sh + echo "${NODEPOOL_UCA_MIRROR}" + args: + executable: /bin/bash + register: uca_repo_url + delegate_to: localhost when: - ansible_pkg_mgr == 'apt' - delegate_to: localhost + - nodepool.stat.exists | bool + tags: + - skip_ansible_lint -- name: Set apt repo facts based on discovered information +- name: Set a fact to override uca_apt_repo_url value when in nodepool set_fact: - lxc_container_template_main_apt_repo: "{{ ubuntu_repo_url.stdout }}" - lxc_container_template_security_apt_rep: "{{ ubuntu_repo_url.stdout }}" + uca_apt_repo_url: "{{ uca_repo_url.stdout }}" when: - - ansible_os_family == 'Debian' + - ansible_pkg_mgr == 'apt' + - nodepool.stat.exists | bool # NOTE(mhayden): GPG checking for local package installs is normally disabled # by default in CentOS, but the ansible-hardening role enables GPG @@ -52,11 +77,3 @@ - { src: '/etc/pip.conf', dest: '/etc/pip.conf' } when: - nodepool.stat.exists | bool - -- name: Set Ubuntu Cloud Archive repo URL based on discovered information - set_fact: - uca_apt_repo_url: "{{ ubuntu_repo_url.stdout | netorigin }}/ubuntu-cloud-archive" - when: - - nodepool.stat.exists | bool - - ansible_pkg_mgr == 'apt' - - nodepool.stat.exists | bool