Add overcloud delete role

The role will delete the current overcloud

Change-Id: I2e3d36d39bd2693588a70bbd5ac6e36666e79f84
This commit is contained in:
Gabriele Cerami 2016-11-24 23:16:07 +01:00
parent 9485d85815
commit 6db38085ef
5 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,15 @@
# This is the playbook used by the `quickstart.sh` script.
- include: quickstart-extras.yml
- name: Collect logs, create docs, publish
hosts: all:!localhost
gather_facts: no
roles:
- { role: tripleo-collect-logs, artcl_collect: true }
- name: test overcloud deletion
hosts: undercloud
gather_facts: no
roles:
- { role: overcloud-delete }

View File

@ -0,0 +1,8 @@
# Script and log locations used during the delete process.
delete_script: overcloud_delete.sh.j2
delete_log: "{{ working_dir }}/overcloud_delete.log"
# 30 retries * 10 seconds delay = 5 minutes delete timeout
delete_check_retries: 30
delete_check_delay: 10
step_delete_overcloud: false

View File

@ -0,0 +1,2 @@
dependencies:
- extras-common

View File

@ -0,0 +1,29 @@
# Generate a script from templates. These are scripts
# rather than additional ansible tasks so that they can be run
# manually from the undercloud host.
- name: Create overcloud delete script
template:
src: "{{ delete_script }}"
dest: "{{ working_dir }}/overcloud-delete.sh"
mode: 0755
tags:
- overcloud-scripts
- block:
when: step_delete_overcloud|bool
- name: Delete the overcloud
shell: |
{{ working_dir }}/overcloud-delete.sh > {{ delete_log }} 2>&1
tags:
- overcloud-delete
- name: check for delete command to complete or fail
tasks:
- shell: |
heat stack-show $(cat {{ working_dir }}/overcloud_id)
register: heat_stack_show
delay: {{ delete_check_delay }}
retries: {{ delete_check_retries }}
until: {{ heat_show.stdout.find("DELETE_COMPLETE") }}
tags:
- overcloud-delete

View File

@ -0,0 +1,22 @@
### --start_docs
## Delete the overcloud deployment
## ===============================
## * Gather informations on the deployment
## ::
source {{ working_dir}}/stackrc
OVERCLOUD_NAME="overcloud"
OVERCLOUD_ID=$(openstack stack list | grep "$OVERCLOUD_NAME" | awk '{print $2}')
echo $OVERCLOUD_ID > {{ working_dir }}/overcloud_id
## * select the correct command for the deletion
## ::
if heat stack-delete --help | grep -q "\-\-yes"; then
heat stack-delete --yes "$OVERCLOUD_NAME"
else
heat stack-delete "$OVERCLOUD_NAME"
fi
### --stop_docs