43e61820f4
Added get_url as an alternate downloader, when aria2 is failing due to SSL error. Now it happens for CentOS and is reproducable. We probably won't need this patch once aria2 package will be fixed. Change-Id: I7770c5417feacfc43a3ad8801125603a55ba9ea8
68 lines
2.0 KiB
YAML
68 lines
2.0 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
|
|
|
|
- name: Ensure image has been pre-staged
|
|
async_status:
|
|
jid: "{{ prestage_image.ansible_job_id }}"
|
|
register: job_result
|
|
until: job_result.finished
|
|
ignore_errors: true
|
|
retries: 60
|
|
|
|
- name: Trying to download image with alternate method
|
|
get_url:
|
|
url: "{{ lxc_hosts_container_image_url }}"
|
|
dest: "/tmp/{{ cache_basename }}"
|
|
validate_certs: "{{ (lxc_hosts_validate_certs | bool) | lower }}"
|
|
force: true
|
|
when: job_result.failed
|
|
|
|
- name: Ensure systemd-importd is enabled
|
|
systemd:
|
|
name: "systemd-importd"
|
|
state: "started"
|
|
enabled: "yes"
|
|
daemon_reload: "yes"
|
|
notify:
|
|
- Restart importd
|
|
|
|
- name: Retrieve base image
|
|
command: >-
|
|
machinectl
|
|
--verify=no
|
|
{{ lxc_image_cache_pull_mode }}
|
|
/tmp/{{ cache_basename }}
|
|
{{ lxc_container_base_name }}
|
|
register: pull_image
|
|
until: pull_image is success
|
|
retries: 3
|
|
delay: 1
|
|
changed_when: pull_image.rc == 0
|
|
failed_when:
|
|
- pull_image.rc != 0
|
|
- "'failed' in pull_image.stderr | lower"
|
|
notify:
|
|
- Remove rootfs archive
|