Fetch images in a standalone role

This functionality is useful in non-libvirt environments, so separate it
and include it with the new Ansible 2.2 include_role method.

Change-Id: I2ed5dd8115cce012a007b7d791777b052034a17a
This commit is contained in:
Attila Darazs 2016-12-08 19:05:38 +01:00 committed by John Trowbridge
parent 1bc3402969
commit 2d42633a43
4 changed files with 26 additions and 21 deletions

View File

@ -0,0 +1,2 @@
dependencies:
- common

View File

@ -1,20 +1,3 @@
# Fetching the undercloud images can take a long time. This
# tasklist caches images in `{{ image_cache_dir }}` if an image is
# (a) downloaded successfully and (b) successfully verifies against
# the checksum. Images are cached using the checksum as the filename,
# and subsequent playbook runs will use the cached copy rather than
# trying to fetch the remote copy.
# This checks that the image_cache_dir directory exists. When running
# the full quickstart, this is created by the provision/remote role.
# If you are running this role by itself, you will need to ensure that
# either the directory exists ahead of time or that ansible has the
# permissions to create the directory.
- name: Ensure image cache directory exists
file:
path: "{{ image_cache_dir }}"
state: directory
# Set some convenience variables here to avoid boilerplate code
# elsewhere in this file. These are all set unconditionally to avoid
# any cruft leftover from a previous call to this file.

View File

@ -0,0 +1,21 @@
# Fetching the undercloud images can take a long time. This
# role caches images in `{{ image_cache_dir }}` if an image is
# (a) downloaded successfully and (b) successfully verifies against
# the checksum. Images are cached using the checksum as the filename,
# and subsequent playbook runs will use the cached copy rather than
# trying to fetch the remote copy.
# This checks that the image_cache_dir directory exists. When running
# the full quickstart, this is created by the provision/remote role.
# If you are running this role by itself, you will need to ensure that
# either the directory exists ahead of time or that ansible has the
# permissions to create the directory.
- name: Ensure image cache directory exists
file:
path: "{{ image_cache_dir }}"
state: directory
- include: fetch.yml
vars:
image: "{{ item }}"
with_items: "{{ images }}"

View File

@ -31,10 +31,9 @@
# Conditionally include a playbook for all the images specified
# in options that downloads, cache and extract if tar archived
# only if the images aren't already in volume pool
- include: fetch_image.yml
vars:
image: "{{ item }}"
with_items: "{{ images }}"
- name: Fetch the images
include_role:
name: fetch-images
# Conditionally include a playbook for all the images specified
# in options that updates images to the latest delorean version