Browse Source

Merge "Add playbook for config-download export"

changes/54/735254/1
Zuul 4 weeks ago
committed by Gerrit Code Review
parent
commit
c15a7ce013
1 changed files with 69 additions and 0 deletions
  1. +69
    -0
      tripleo_ansible/playbooks/cli-config-download-export.yaml

+ 69
- 0
tripleo_ansible/playbooks/cli-config-download-export.yaml 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

Loading…
Cancel
Save