Merge "Add playbook for config-download export"

This commit is contained in:
Zuul 2020-06-11 16:56:26 +00:00 committed by Gerrit Code Review
commit c15a7ce013
1 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,69 @@
---
# 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.
- name: Config Download Export
connection: "{{ (tripleo_target_host is defined) | ternary('ssh', 'local') }}"
hosts: "{{ tripleo_target_host | default('localhost') }}"
remote_user: "{{ tripleo_target_user | default(lookup('env', 'USER')) }}"
gather_facts: "{{ (tripleo_target_host is defined) | ternary(true, false) }}"
any_errors_fatal: true
vars:
plan: overcloud
config_type: null
preserve_config: true
pre_tasks:
- name: Set config_dir
set_fact:
config_dir: "{{ lookup('env', 'HOME')~'/tripleo-config' }}"
when: config_dir is not defined
- name: Set config_container
set_fact:
config_container: "{{ plan ~ '-config' }}"
tasks:
- name: Clean config_dir
file:
path: "{{ config_dir }}"
state: absent
when: not preserve_config | bool
- name: Create config dir if does not exist
file:
path: "{{ config_dir }}"
state: directory
- name: Get config
tripleo_config_download:
plan: "{{ plan }}"
config_container: "{{ config_container }}"
config_type: "{{ config_type }}"
download: false
- name: Get temp url for archive
tripleo_swift_tempurl:
container: "{{ config_container }}"
object: "{{ config_container ~ '.tar.gz' }}"
method: GET
register: config_download_url
- name: Extract config download
unarchive:
src: "{{ config_download_url.tempurl }}"
dest: "{{ config_dir }}"
remote_src: true