Merge "Remove the tripleo-persist role"
This commit is contained in:
commit
dff59120cc
|
@ -1,51 +0,0 @@
|
||||||
tripleo-persist
|
|
||||||
===============
|
|
||||||
|
|
||||||
An Ansible role to temporary persist a files on undercloud and later
|
|
||||||
restore them.
|
|
||||||
|
|
||||||
Role variables
|
|
||||||
--------------
|
|
||||||
|
|
||||||
Required:
|
|
||||||
|
|
||||||
* `tripleo_persist_dir` -- directory on the target host to persist
|
|
||||||
|
|
||||||
Optional:
|
|
||||||
|
|
||||||
* `tripleo_persist_storage_root_dir` -- directory on the Ansible host
|
|
||||||
under which all data is stored
|
|
||||||
(defaults to "/var/lib/mistral/tripleo-persist")
|
|
||||||
* `tripleo_persist_storage_root_become` -- whether to use `become`
|
|
||||||
when creating the storage root directory
|
|
||||||
(defaults to false)
|
|
||||||
|
|
||||||
Test playbook
|
|
||||||
-------------
|
|
||||||
|
|
||||||
Assuming you have tripleo-inventory.yml generated, you can run the
|
|
||||||
test playbook like:
|
|
||||||
|
|
||||||
ANSIBLE_ROLES_PATH=tripleo-common/roles \
|
|
||||||
ANSIBLE_HOST_KEY_CHECKING=False \
|
|
||||||
ansible-playbook
|
|
||||||
-i tripleo-inventory.yml \
|
|
||||||
tripleo-common/roles/tripleo-persist/test-playbook.yml \
|
|
||||||
-e persist=true
|
|
||||||
|
|
||||||
ANSIBLE_ROLES_PATH=tripleo-common/roles \
|
|
||||||
ANSIBLE_HOST_KEY_CHECKING=False \
|
|
||||||
ansible-playbook
|
|
||||||
-i tripleo-inventory.yml \
|
|
||||||
tripleo-common/roles/tripleo-persist/test-playbook.yml \
|
|
||||||
-e restore=true
|
|
||||||
|
|
||||||
License
|
|
||||||
-------
|
|
||||||
|
|
||||||
Free software: Apache License (2.0)
|
|
||||||
|
|
||||||
Author Information
|
|
||||||
------------------
|
|
||||||
|
|
||||||
OpenStack TripleO team
|
|
|
@ -1,2 +0,0 @@
|
||||||
tripleo_persist_storage_root_dir: /var/lib/mistral/tripleo-persist
|
|
||||||
tripleo_persist_storage_root_become: false
|
|
|
@ -1,6 +0,0 @@
|
||||||
- name: ensure tripleo_persist storage directory is removed
|
|
||||||
file:
|
|
||||||
path: "{{ tripleo_persist_storage_root_dir }}"
|
|
||||||
state: absent
|
|
||||||
delegate_to: localhost
|
|
||||||
become: "{{ tripleo_persist_storage_root_become }}"
|
|
|
@ -1,37 +0,0 @@
|
||||||
- name: ensure local storage directory exists and has correct permissions
|
|
||||||
file:
|
|
||||||
path: "{{ tripleo_persist_storage_root_dir }}"
|
|
||||||
# Attempting to set an owner fails with "chown failed: failed to
|
|
||||||
# look up user" so we at least ensure the permissions.
|
|
||||||
mode: 0700
|
|
||||||
state: directory
|
|
||||||
delegate_to: localhost
|
|
||||||
become: "{{ tripleo_persist_storage_root_become }}"
|
|
||||||
|
|
||||||
- name: create tempfile for the archive
|
|
||||||
tempfile:
|
|
||||||
prefix: ansible.tripleo-persist.
|
|
||||||
register: tripleo_persist_tempfile
|
|
||||||
|
|
||||||
- name: make sure we don't have a trailing forward slash
|
|
||||||
set_fact:
|
|
||||||
tripleo_persist_dir_safe: "{{ tripleo_persist_dir|regex_replace('\\/$', '') }}"
|
|
||||||
cacheable: no
|
|
||||||
|
|
||||||
# Using the "archive" module lists lists all tarred files in module
|
|
||||||
# output, if there's too many files, it can crash ansible even with
|
|
||||||
# "no_log: true".
|
|
||||||
- name: create the archive
|
|
||||||
shell: |
|
|
||||||
tar -czf "{{ tripleo_persist_tempfile.path }}" -C "{{ tripleo_persist_dir_safe|dirname }}" "{{ tripleo_persist_dir_safe|basename }}"
|
|
||||||
|
|
||||||
- name: fetch the archive
|
|
||||||
fetch:
|
|
||||||
src: "{{ tripleo_persist_tempfile.path }}"
|
|
||||||
dest: "{{ tripleo_persist_storage_root_dir }}/{{ inventory_hostname }}{{ tripleo_persist_dir_safe }}.tar.gz"
|
|
||||||
flat: yes
|
|
||||||
|
|
||||||
- name: remove tempfile
|
|
||||||
file:
|
|
||||||
name: "{{ tripleo_persist_tempfile.path }}"
|
|
||||||
state: absent
|
|
|
@ -1,14 +0,0 @@
|
||||||
- name: make sure we don't have a trailing forward slash
|
|
||||||
set_fact:
|
|
||||||
tripleo_persist_dir_safe: "{{ tripleo_persist_dir|regex_replace('\\/$', '') }}"
|
|
||||||
cacheable: no
|
|
||||||
|
|
||||||
- name: make sure the parent directory is present
|
|
||||||
file:
|
|
||||||
path: "{{ tripleo_persist_dir_safe|dirname }}"
|
|
||||||
state: directory
|
|
||||||
|
|
||||||
- name: push and extract the archive
|
|
||||||
unarchive:
|
|
||||||
src: "{{ tripleo_persist_storage_root_dir }}/{{ inventory_hostname }}{{ tripleo_persist_dir_safe }}.tar.gz"
|
|
||||||
dest: "{{ tripleo_persist_dir_safe|dirname }}"
|
|
|
@ -1,20 +0,0 @@
|
||||||
- hosts: overcloud-controller-0
|
|
||||||
become: true
|
|
||||||
tasks:
|
|
||||||
- name: test tripleo-persist persistence
|
|
||||||
include_role:
|
|
||||||
name: tripleo-persist
|
|
||||||
tasks_from: persist.yml
|
|
||||||
vars:
|
|
||||||
tripleo_persist_dir: /testdir/testsubdir
|
|
||||||
tripleo_persist_storage_root_dir: /home/stack/tripleo-persist
|
|
||||||
when: persist|default(false)|bool
|
|
||||||
|
|
||||||
- name: test tripleo-persist restoration
|
|
||||||
include_role:
|
|
||||||
name: tripleo-persist
|
|
||||||
tasks_from: restore.yml
|
|
||||||
vars:
|
|
||||||
tripleo_persist_dir: /testdir/testsubdir
|
|
||||||
tripleo_persist_storage_root_dir: /home/stack/tripleo-persist
|
|
||||||
when: restore|default(false)|bool
|
|
Loading…
Reference in New Issue