From 172e3e4bd09dcd4a0c7fea222596f0ddef19f8df Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Tue, 16 Feb 2021 09:22:47 +0000 Subject: [PATCH] Update Centos-8 LXC image to 8.3 This requires extra ansible tasks to unpack the nested tar file structure of the 8.3 container image. Depends-On: I31880ca995735b737d33532eaa4c29be02523117 Change-Id: I443f5b9ecef1c142dcbcac91a0f36cb28035f3f6 --- tasks/lxc_cache_preparation_simple.yml | 20 ++++++++++++++++++++ vars/redhat.yml | 13 ++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/tasks/lxc_cache_preparation_simple.yml b/tasks/lxc_cache_preparation_simple.yml index b7cc60c2..69bb835f 100644 --- a/tasks/lxc_cache_preparation_simple.yml +++ b/tasks/lxc_cache_preparation_simple.yml @@ -77,4 +77,24 @@ src: "/tmp/{{ cache_basename }}" dest: "/var/lib/machines/{{ lxc_container_base_name }}" remote_src: yes + extra_opts: "{{ _lxc_hosts_unarchive_extra_opts | default(omit) }}" when: create_new_dir is changed + +# NOTE(jrosser) Centos 8.3 images ships as a nested tar file, these tasks unpack and remove +# the inner tar file +- name: Unpack nested tar file + unarchive: + src: "/var/lib/machines/{{ lxc_container_base_name }}/{{ _lxc_hosts_nested_tar_file }}" + dest: "/var/lib/machines/{{ lxc_container_base_name }}" + remote_src: yes + when: + - create_new_dir is changed + - _lxc_hosts_nested_tar_file is defined + +- name: Remove nested tar file + file: + path: "/var/lib/machines/{{ lxc_container_base_name }}/{{ _lxc_hosts_nested_tar_file }}" + state: absent + when: + - create_new_dir is changed + - _lxc_hosts_nested_tar_file is defined diff --git a/vars/redhat.yml b/vars/redhat.yml index 21f05394..12bb003a 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -13,7 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -_lxc_hosts_container_image_url: "https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-Container-8.1.1911-20200113.3-layer.x86_64.tar.xz" +_lxc_hosts_container_image_url: "https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-Container-8.3.2011-20201204.2.x86_64.tar.xz" + +# the Centos 8.3 image contains a tar file inside the downloaded tar +_lxc_hosts_nested_tar_file: "layer.tar" + +# layer.tar is in a subdirectory named with a numerical hash, we must descend +# into that directory without knowing it's name, and extract just the inner +# tar file +_lxc_hosts_unarchive_extra_opts: + - --strip-components=1 + - --no-anchored + - "{{ _lxc_hosts_nested_tar_file }}" _lxc_cache_map: distro: centos