From 1aae204447331a410b4fbfa2aa88292580ac7d12 Mon Sep 17 00:00:00 2001 From: Dmitry Shulyak Date: Tue, 2 Jun 2015 15:01:16 +0200 Subject: [PATCH] Add removal of keystone service and endpoint --- library/keystone_service.py | 8 ++++++-- .../actions/remove.yaml | 20 ++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/library/keystone_service.py b/library/keystone_service.py index f1278673..ab0425c8 100644 --- a/library/keystone_service.py +++ b/library/keystone_service.py @@ -202,11 +202,15 @@ def ensure_endpoint_present(keystone, name, public_url, internal_url, def ensure_service_absent(keystone, name, check_mode): """ Ensure the service is absent""" - raise NotImplementedError() + service = get_service(keystone, name) + keystone.services.delete(service.id) + return True def ensure_endpoint_absent(keystone, name, check_mode): """ Ensure the service endpoint """ - raise NotImplementedError() + endpoint = get_endpoint(keystone, name) + keystone.endpoints.delete(endpoint.id) + return True def dispatch(keystone, name, service_type, description, public_url, diff --git a/resources/keystone_service_endpoint/actions/remove.yaml b/resources/keystone_service_endpoint/actions/remove.yaml index 67218324..dadc9aea 100644 --- a/resources/keystone_service_endpoint/actions/remove.yaml +++ b/resources/keystone_service_endpoint/actions/remove.yaml @@ -1,6 +1,20 @@ - hosts: [{{ ip }}] sudo: yes + vars: + ip: {{ip}} + port: {{port}} + admin_port: {{admin_port}} tasks: - - name: keystone service and endpoint - #TODO: not implemented in module - pause: seconds=1 + - name: remove keystone service and endpoint + keystone_service: + token: {{admin_token}} + name: {{name}} + type: {{type}} + description: {{description}} + publicurl: {{publicurl}} + internalurl: {{internalurl}} + adminurl: {{adminurl}} + region: "RegionOne" + state: present + endpoint: http://{{keystone_host}}:{{keystone_port}}/v2.0/ +