Confirm container destroys
Running the lxc-containers-destroy playbook will, by default, destroy all containers and container data across the entire deployment. Include a prompt to ensure that running the playbook was intentional. Including this playbook within automation can still be done by providing 'force_containers_destroy' as an extra variable. Change-Id: I534cc97a29018984966ca9a9d934cef4242f2f88
This commit is contained in:
parent
3f7341f2be
commit
4a7e9541ee
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
# Copyright 2014, Rackspace US, Inc.
|
# Copyright 2016, Rackspace US, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@ -24,6 +24,7 @@
|
|||||||
name: "{{ container_name }}"
|
name: "{{ container_name }}"
|
||||||
state: "absent"
|
state: "absent"
|
||||||
delegate_to: "{{ physical_host }}"
|
delegate_to: "{{ physical_host }}"
|
||||||
|
when: force_containers_destroy | bool
|
||||||
tags:
|
tags:
|
||||||
- container-destroy
|
- container-destroy
|
||||||
- name: Destroy container service directories
|
- name: Destroy container service directories
|
||||||
@ -37,5 +38,12 @@
|
|||||||
- "/var/lib/lxc/{{ container_name }}"
|
- "/var/lib/lxc/{{ container_name }}"
|
||||||
- "{{ lxc_container_directory|default('/var/lib/lxc') }}/{{ container_name }}"
|
- "{{ lxc_container_directory|default('/var/lib/lxc') }}/{{ container_name }}"
|
||||||
delegate_to: "{{ physical_host }}"
|
delegate_to: "{{ physical_host }}"
|
||||||
|
when: force_containers_destroy | bool
|
||||||
tags:
|
tags:
|
||||||
- container-directories
|
- container-directories
|
||||||
|
vars_prompt:
|
||||||
|
- name: "force_containers_destroy"
|
||||||
|
prompt: "Are you sure you want to destroy LXC containers?"
|
||||||
|
default: "no"
|
||||||
|
private: no
|
||||||
|
when: force_containers_destroy is undefined
|
||||||
|
1
tox.ini
1
tox.ini
@ -87,6 +87,7 @@ commands =
|
|||||||
ansible-playbook -i 'localhost ansible-connection=local,' \
|
ansible-playbook -i 'localhost ansible-connection=local,' \
|
||||||
--syntax-check \
|
--syntax-check \
|
||||||
--list-tasks \
|
--list-tasks \
|
||||||
|
-e 'force_containers_destroy=yes' \
|
||||||
{toxinidir}/playbooks/*.yml"
|
{toxinidir}/playbooks/*.yml"
|
||||||
|
|
||||||
[testenv:inventory]
|
[testenv:inventory]
|
||||||
|
Loading…
Reference in New Issue
Block a user