Add overcloud delete role
The role will delete the current overcloud Change-Id: I2e3d36d39bd2693588a70bbd5ac6e36666e79f84
This commit is contained in:
parent
9485d85815
commit
6db38085ef
15
playbooks/deploy-delete.yml
Normal file
15
playbooks/deploy-delete.yml
Normal 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 }
|
8
roles/overcloud-delete/defaults/main.yml
Normal file
8
roles/overcloud-delete/defaults/main.yml
Normal 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
|
2
roles/overcloud-delete/meta/main.yml
Normal file
2
roles/overcloud-delete/meta/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- extras-common
|
29
roles/overcloud-delete/tasks/main.yml
Normal file
29
roles/overcloud-delete/tasks/main.yml
Normal 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
|
22
roles/overcloud-delete/templates/overcloud_delete.sh.j2
Normal file
22
roles/overcloud-delete/templates/overcloud_delete.sh.j2
Normal 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
|
Loading…
x
Reference in New Issue
Block a user