Prepare container images using tripleo ansible role

The THT file has been converted to use a newly created role found within
TripleO-Ansible. The THT process will now run all tasks through the role
using "include_role". To ensure we're keeping things separated, all of
the data transformations will still be taken care of in the heat template.
This ensures we have clean lines of separation allowing both services to
work as expected, without nuance or confusion.

Depends-On: Ic6e26eb95734ccf17e42e649b5e5808e1a096a78
Change-Id: I3a87dbb6e9fdaf78f6ffa2ac03a0069222c12d48
Story: 2005985
Task: 34442
Signed-off-by: Kevin Carter <kevin@cloudnull.com>
This commit is contained in:
Kevin Carter 2019-08-02 14:48:35 -05:00 committed by Kevin Carter (cloudnull)
parent b30587e94f
commit f20fddaee1
1 changed files with 21 additions and 57 deletions

View File

@ -79,13 +79,13 @@ parameters:
{% for role in roles %} {% for role in roles %}
# Parameters generated for {{role.name}} Role # Parameters generated for {{role.name}} Role
{{role.name}}Services: {{ role.name }}Services:
description: A list of service resources (configured in the Heat description: A list of service resources (configured in the Heat
resource_registry) which represent nested stacks resource_registry) which represent nested stacks
for each service that should get installed on the {{role.name}} role. for each service that should get installed on the {{role.name}} role.
type: comma_delimited_list type: comma_delimited_list
{{role.name}}Count: {{ role.name }}Count:
description: Number of {{role.name}} nodes to deploy description: Number of {{role.name}} nodes to deploy
type: number type: number
default: {{role.CountDefault|default(0)}} default: {{role.CountDefault|default(0)}}
@ -97,60 +97,24 @@ outputs:
value: value:
service_name: container_image_prepare service_name: container_image_prepare
external_deploy_tasks: external_deploy_tasks:
- name: Container image prepare - name: Run tripleo-container-image-prepare role
when: step|int == 1 include_role:
tags: container_image_prepare name: tripleo-container-image-prepare
block: vars:
- set_fact: tripleo_container_image_prepare_log_file: {get_param: ContainerImagePrepareLogFile}
log_file: {get_param: ContainerImagePrepareLogFile} tripleo_container_image_prepare_debug: {get_param: ContainerImagePrepareDebug}
container_image_prepare_debug: {get_param: ContainerImagePrepareDebug} tripleo_container_image_prepare_roles: {{ roles }}
- name: Create temp file for prepare parameter tripleo_container_image_prepare_content:
tempfile: parameter_defaults:
state: file ContainerImagePrepare: {get_param: ContainerImagePrepare}
suffix: -prepare-param DockerInsecureRegistryAddress: {get_param: DockerInsecureRegistryAddress}
register: prepare_param NeutronMechanismDrivers: {get_param: NeutronMechanismDrivers}
check_mode: no DockerRegistryMirror: {get_param: DockerRegistryMirror}
- name: Create temp file for role data ContainerImageRegistryCredentials: {get_param: ContainerImageRegistryCredentials}
tempfile: AdditionalArchitectures: {get_param: AdditionalArchitectures}
state: file
suffix: -role-data
register: role_data
check_mode: no
- name: Write ContainerImagePrepare parameter file
copy:
dest: "{{ '{{' }} prepare_param.path {{ '}}' }}"
content:
parameter_defaults:
ContainerImagePrepare: {get_param: ContainerImagePrepare}
DockerInsecureRegistryAddress: {get_param: DockerInsecureRegistryAddress}
NeutronMechanismDrivers: {get_param: NeutronMechanismDrivers}
DockerRegistryMirror: {get_param: DockerRegistryMirror}
ContainerImageRegistryCredentials: {get_param: ContainerImageRegistryCredentials}
AdditionalArchitectures: {get_param: AdditionalArchitectures}
{% for role in roles %} {% for role in roles %}
{{role.name}}Services: {get_param: {{role.name}}Services} {{ role.name }}Services: {get_param: {{role.name}}Services}
{{role.name}}Count: {get_param: {{role.name}}Count} {{ role.name }}Count: {get_param: {{role.name}}Count}
{% endfor %} {% endfor %}
- name: Write role data file when:
copy: - (step | int) == 1
dest: "{{ '{{' }} role_data.path {{ '}}' }}"
content: {{ roles }}
- name: Run tripleo-container-image-prepare logged to {{ '{{' }} log_file {{ '}}' }}
shell: |
sudo /usr/bin/tripleo-container-image-prepare \
--roles-file {{ '{{' }} role_data.path {{ '}}' }} \
--environment-file {{ '{{' }} prepare_param.path {{ '}}' }} \
--cleanup partial \
--log-file {{ '{{' }} log_file {{ '}}' }}{{ '{' }}% if container_image_prepare_debug|default(false) %{{ '}' }} \
--debug > {{ '{{' }} log_file {{ '}}' }} 2>&1{{ '{' }}% endif %{{ '}' }}
no_log: True
- name: Delete param file
file:
dest: "{{ '{{' }} prepare_param.path {{ '}}' }}"
state: absent
check_mode: no
- name: Delete role file
file:
dest: "{{ '{{' }} role_data.path {{ '}}' }}"
state: absent
check_mode: no