Support destroying the overcloud services
'kayobe overcloud service destroy' will destroy all containers, container images, and volumes on the overcloud hosts. All data will be lost, so use wisely!
This commit is contained in:
parent
efed119813
commit
2693269955
@ -4,7 +4,7 @@
|
||||
# Follows kolla-ansible service deployment patterns.
|
||||
#
|
||||
# Variables:
|
||||
# action: One of deploy, pull, reconfigure, upgrade
|
||||
# action: One of deploy, destroy, pull, reconfigure, upgrade
|
||||
|
||||
- name: Ensure a local Docker registry is deployed
|
||||
hosts: controllers[0]
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Follows kolla-ansible service deployment patterns.
|
||||
#
|
||||
# Variables:
|
||||
# action: One of deploy, pull, reconfigure, upgrade
|
||||
# action: One of deploy, destroy, pull, reconfigure, upgrade
|
||||
|
||||
- name: Ensure OpenSM is deployed
|
||||
hosts: controllers[0]
|
||||
|
@ -5,7 +5,7 @@
|
||||
# Follows kolla-ansible service deployment patterns.
|
||||
#
|
||||
# Variables:
|
||||
# action: One of deploy, pull, reconfigure, upgrade
|
||||
# action: One of deploy, destroy, pull, reconfigure, upgrade
|
||||
|
||||
- include: docker-registry.yml
|
||||
- include: opensm.yml
|
||||
|
@ -9,6 +9,6 @@
|
||||
read_only: "{{ item.value.read_only | default(omit) }}"
|
||||
restart_policy: "{{ docker_registry_restart_policy }}"
|
||||
restart_retries: "{{ docker_registry_restart_retries }}"
|
||||
state: "{{ 'started' if item.value.enabled | bool else 'absent' }}"
|
||||
state: "{{ 'started' if item.value.enabled and action != 'destroy' | bool else 'absent' }}"
|
||||
volumes: "{{ item.value.volumes }}"
|
||||
with_dict: "{{ docker_registry_services }}"
|
||||
|
1
ansible/roles/docker-registry/tasks/destroy.yml
Symbolic link
1
ansible/roles/docker-registry/tasks/destroy.yml
Symbolic link
@ -0,0 +1 @@
|
||||
deploy.yml
|
@ -9,6 +9,6 @@
|
||||
read_only: "{{ item.value.read_only | default(omit) }}"
|
||||
restart_policy: "{{ opensm_restart_policy }}"
|
||||
restart_retries: "{{ opensm_restart_retries }}"
|
||||
state: "{{ 'started' if item.value.enabled | bool else 'absent' }}"
|
||||
state: "{{ 'started' if item.value.enabled and action != 'destroy' | bool else 'absent' }}"
|
||||
volumes: "{{ item.value.volumes }}"
|
||||
with_dict: "{{ opensm_services }}"
|
||||
|
1
ansible/roles/opensm/tasks/destroy.yml
Symbolic link
1
ansible/roles/opensm/tasks/destroy.yml
Symbolic link
@ -0,0 +1 @@
|
||||
deploy.yml
|
@ -45,6 +45,18 @@ and/or kolla-ansible::
|
||||
|
||||
(kayobe-venv) $ kayobe overcloud service upgrade --tags config --kolla-tags keystone
|
||||
|
||||
Destroying the Overcloud Services
|
||||
=================================
|
||||
|
||||
.. note::
|
||||
|
||||
This step will destroy all containers, container images, volumes and data on
|
||||
the overcloud hosts.
|
||||
|
||||
To destroy the overcloud services::
|
||||
|
||||
(kayobe-venv) $ kayobe overcloud service destroy --yes-i-really-really-mean-it
|
||||
|
||||
Deprovisioning The Cloud
|
||||
========================
|
||||
|
||||
|
@ -486,6 +486,45 @@ class OvercloudServiceUpgrade(KollaAnsibleMixin, KayobeAnsibleMixin,
|
||||
extra_vars=extra_vars)
|
||||
|
||||
|
||||
class OvercloudServiceDestroy(KollaAnsibleMixin, KayobeAnsibleMixin,
|
||||
VaultMixin, Command):
|
||||
"""Destroy the overcloud services."""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(OvercloudServiceDestroy, self).get_parser(prog_name)
|
||||
group = parser.add_argument_group("Services")
|
||||
group.add_argument("--yes-i-really-really-mean-it",
|
||||
action='store_true',
|
||||
help="confirm that you understand that this will "
|
||||
"permantently destroy all services and data.")
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
if not parsed_args.yes_i_really_really_mean_it:
|
||||
self.app.LOG.error("This will permanently destroy all services "
|
||||
"and data. Specify "
|
||||
"--yes-i-really-really-mean-it to confirm that "
|
||||
"you understand this.")
|
||||
sys.exit(1)
|
||||
|
||||
self.app.LOG.debug("Destroying overcloud services")
|
||||
|
||||
# First prepare configuration.
|
||||
playbooks = _build_playbook_list("kolla-ansible", "kolla-openstack")
|
||||
self.run_kayobe_playbooks(parsed_args, playbooks)
|
||||
|
||||
# Run kolla-ansible destroy.
|
||||
extra_args = ["--yes-i-really-really-mean-it"]
|
||||
self.run_kolla_ansible_overcloud(parsed_args, "destroy",
|
||||
extra_args=extra_args)
|
||||
|
||||
# Destroy kayobe extra services.
|
||||
playbooks = _build_playbook_list("overcloud-extras")
|
||||
extra_vars = {"action": "destroy"}
|
||||
self.run_kayobe_playbooks(parsed_args, playbooks,
|
||||
extra_vars=extra_vars)
|
||||
|
||||
|
||||
class OvercloudContainerImagePull(KayobeAnsibleMixin, KollaAnsibleMixin,
|
||||
VaultMixin, Command):
|
||||
"""Pull the overcloud container images from a registry."""
|
||||
|
1
setup.py
1
setup.py
@ -66,6 +66,7 @@ setup(
|
||||
'overcloud_post_configure = kayobe.cli.commands:OvercloudPostConfigure',
|
||||
'overcloud_provision = kayobe.cli.commands:OvercloudProvision',
|
||||
'overcloud_service_deploy = kayobe.cli.commands:OvercloudServiceDeploy',
|
||||
'overcloud_service_destroy = kayobe.cli.commands:OvercloudServiceDestroy',
|
||||
'overcloud_service_reconfigure = kayobe.cli.commands:OvercloudServiceReconfigure',
|
||||
'overcloud_service_upgrade = kayobe.cli.commands:OvercloudServiceUpgrade',
|
||||
'physical_network_configure = kayobe.cli.commands:PhysicalNetworkConfigure',
|
||||
|
Loading…
Reference in New Issue
Block a user