
This patch adds an async task to download the LXC image using aria2 with retries and read timeouts. Closes-Bug: 1709329 Change-Id: Ib9ec6195dcb7e0e4b18b8526f030e6738f9953e8 Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
59 lines
1.8 KiB
YAML
59 lines
1.8 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.
|
|
|
|
# NOTE(cloudnull): When modern SystemD is running everywhere this can be
|
|
# collapsed back into the base preparation task file.
|
|
- name: Remove old image cache
|
|
command: "machinectl remove {{ lxc_container_base_name }}"
|
|
register: cache_refresh
|
|
changed_when: cache_refresh.rc == 0
|
|
failed_when: cache_refresh.rc not in [0, 1]
|
|
when:
|
|
- lxc_image_cache_refresh | bool
|
|
|
|
# NOTE(cloudnull): When modern SystemD is running everywhere this can be
|
|
# collapsed back into the base preparation task file.
|
|
- name: Set volume size
|
|
shell: machinectl set-limit {{ lxc_host_machine_volume_size }}G
|
|
changed_when: false
|
|
args:
|
|
executable: /bin/bash
|
|
|
|
- name: Ensure image has been pre-staged
|
|
async_status:
|
|
jid: "{{ item.ansible_job_id }}"
|
|
register: job_result
|
|
until: job_result.finished
|
|
retries: 30
|
|
with_items:
|
|
- "{{ prestage_image.results }}"
|
|
|
|
- name: Retrieve base image
|
|
command: >-
|
|
machinectl
|
|
--verify=no
|
|
{{ lxc_image_cache_pull_mode }}
|
|
/tmp/rootfs.tar.xz
|
|
{{ lxc_container_base_name }}
|
|
register: pull_image
|
|
until: pull_image | success
|
|
retries: 3
|
|
delay: 1
|
|
changed_when: pull_image.rc == 0
|
|
failed_when:
|
|
- pull_image.rc != 0
|
|
- "'failed' in pull_image.stderr | lower"
|
|
with_items: "{{ lxc_images }}"
|