Run image prepare after registry install

For containerized undercloud install this completes the image
preperation. The flow for undercloud install is now:

1. Early in tripleo deploy there is a dry-run prepare which generates
the heat environment for all of the image parameters
2. Here after the registry is installed, populate it by running
prepare again

This file is now a jinja template so that the prepare command has
access to the roles data. This reduces the number of images processed
to services which *might* be containerized, but we can't filter by
services which *are* containerised because we're inside the heat stack
and don't have access to the full heat environment. The actual image
numbers are:
136 prepare with no filtering
97 prepare filtering only by roles_data_undercloud.yaml
64 prepare with undercloud env+roles_data_undercloud.yaml filtering

This might be a time hit for undercloud jobs, but hopefully not
a big hit for undercloud+overcloud jobs because many of those extra images
will be used in the overcloud.

Change-Id: I7449ee364ec9e976fbe9df95024ce3c42f6459b5
Blueprint: container-prepare-workflow
This commit is contained in:
Steve Baker 2018-05-28 09:11:39 +12:00
parent 161156d750
commit b8b0755f91
1 changed files with 36 additions and 0 deletions

View File

@ -34,6 +34,12 @@ parameters:
default: ''
description: The IP address used to bind the local container registry
type: string
ContainerImagePrepare:
default: {}
description: Used to run "openstack tripleo container image prepare".
This is run after the registry is installed to populate
the registry with images.
type: json
conditions:
local_container_registry_is_empty: {equals : [{get_param: LocalContainerRegistry}, '']}
@ -65,6 +71,36 @@ outputs:
- include_role:
name: container-registry
tasks_from: docker-distribution
- name: Create temp file for prepare parameter
tempfile:
state: file
suffix: -prepare-param
register: prepare_param
- name: Create temp file for role data
tempfile:
state: file
suffix: -role-data
register: role_data
- name: Write ContainerImagePrepare parameter file
copy:
dest: "{{ '{{' }} prepare_param.path {{ '}}' }}"
content:
parameter_defaults:
ContainerImagePrepare: {get_param: ContainerImagePrepare}
- name: Write role data file
copy:
dest: "{{ '{{' }} role_data.path {{ '}}' }}"
content: {{ roles }}
- name: Run openstack tripleo container image prepare
command: openstack tripleo container image prepare --roles-file {{ '{{' }} role_data.path {{ '}}' }} --environment-file {{ '{{' }} prepare_param.path {{ '}}' }}
- name: Delete param file
file:
dest: "{{ '{{' }} prepare_param.path {{ '}}' }}"
state: absent
- name: Delete role file
file:
dest: "{{ '{{' }} role_data.path {{ '}}' }}"
state: absent
upgrade_tasks:
- name: Install docker packages on upgrade if missing
when: step|int == 3