tripleo-ansible/tripleo_ansible/roles/tripleo_container_image_pre.../tasks/main.yml

66 lines
2.2 KiB
YAML

---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# 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.
# "tripleo_container_image_prepare" will search for and load any operating system variable file
- name: Container image prepare
become: true
block:
- name: Create temp file for prepare parameter
tempfile:
state: file
suffix: -prepare-param
register: prepare_param
check_mode: false
notify:
- Delete param file
- name: Write ContainerImagePrepare parameter file
copy:
dest: "{{ prepare_param.path }}"
content: "{{ tripleo_container_image_prepare_content }}"
- name: Create temp file for role data
tempfile:
state: file
suffix: -role-data
register: role_data
check_mode: false
notify:
- Delete role file
- name: Write role data file
copy:
dest: "{{ role_data.path }}"
content: "{{ tripleo_container_image_prepare_roles }}"
- name: "Run tripleo_container_image_prepare logged to: {{ tripleo_container_image_prepare_log_file }}"
command: >-
/usr/bin/tripleo-container-image-prepare
--roles-file {{ role_data.path }}
--environment-file {{ prepare_param.path }}
--cleanup partial
--log-file {{ tripleo_container_image_prepare_log_file }}
{% if (tripleo_container_image_prepare_debug | bool) %}
--debug
{% endif %}
no_log: "{{ not (tripleo_container_image_prepare_debug | bool) }}"
when:
- (tripleo_container_image_prepare_content | dict2items | length) > 0
- (tripleo_container_image_prepare_roles | length) > 0
tags:
- container_image_prepare