62 lines
2.0 KiB
YAML
62 lines
2.0 KiB
YAML
---
|
|
# Copyright 2017, 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.
|
|
|
|
- name: Check cached image status
|
|
command: "machinectl image-status {{ nspawn_container_base_name }}"
|
|
register: cache_check
|
|
changed_when: false
|
|
failed_when: false
|
|
|
|
- name: Set cache refresh fact
|
|
set_fact:
|
|
nspawn_image_cache_refresh: true
|
|
when:
|
|
- cache_check.rc != 0
|
|
|
|
- name: Legacy image url fetch
|
|
block:
|
|
- name: Create legacy image URL fetch
|
|
copy:
|
|
src: "lxc-image-fetch-url.py"
|
|
dest: "/usr/local/bin/lxc-image-fetch-url"
|
|
owner: "root"
|
|
group: "root"
|
|
mode: "0755"
|
|
|
|
- name: Fetch legacy container image url
|
|
command: "/usr/local/bin/lxc-image-fetch-url {{ nspawn_cache_map.distro }} {{ nspawn_cache_map.release }} {{ nspawn_cache_map.arch }} {{ nspawn_cache_default_variant }}"
|
|
register: legacy_image_url
|
|
retries: 3
|
|
delay: 1
|
|
until: legacy_image_url is success
|
|
|
|
- name: Set nspawn cache fact(s) (legacy)
|
|
set_fact:
|
|
nspawn_hosts_container_image_url: "{{ legacy_image_url.stdout.strip() }}"
|
|
when:
|
|
- nspawn_hosts_container_image_download_legacy | bool
|
|
|
|
- name: Pre-stage the nspawn image on the system
|
|
get_url:
|
|
url: "{{ nspawn_hosts_container_image_url }}"
|
|
dest: "/tmp/{{ nspawn_hosts_container_image_url | basename }}"
|
|
validate_certs: "{{ nspawn_hosts_validate_certs | bool }}"
|
|
force: true
|
|
register: prestage_image
|
|
async: 300
|
|
poll: 0
|
|
tags:
|
|
- skip_ansible_lint
|