From 786079a1057edd45cd5b929b75d7d2f968d6e4e6 Mon Sep 17 00:00:00 2001 From: Parker Berberian Date: Wed, 20 Dec 2017 13:21:16 -0500 Subject: [PATCH] Adds workflows to deploy and clean hosts JIRA: PHAROS-322 JIRA: PHAROS-333 Adds the workflows that deploy a host on the start of a booking and cleans the host at the end of the booking automatically. Change-Id: Ice1477df5caf12386402528c4e59637bf0f46670 Signed-off-by: Parker Berberian --- laas-fog/pharoslaas/actions/clean-workflow.yaml | 31 ++++++++++++++ .../pharoslaas/actions/deployment_workflow.yaml | 39 ++++++++++++++++++ .../actions/workflows/clean-workflow.yaml | 16 ++++++++ .../actions/workflows/deployment_workflow.yaml | 47 ++++++++++++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 laas-fog/pharoslaas/actions/clean-workflow.yaml create mode 100644 laas-fog/pharoslaas/actions/deployment_workflow.yaml create mode 100644 laas-fog/pharoslaas/actions/workflows/clean-workflow.yaml create mode 100644 laas-fog/pharoslaas/actions/workflows/deployment_workflow.yaml diff --git a/laas-fog/pharoslaas/actions/clean-workflow.yaml b/laas-fog/pharoslaas/actions/clean-workflow.yaml new file mode 100644 index 0000000..cc93afb --- /dev/null +++ b/laas-fog/pharoslaas/actions/clean-workflow.yaml @@ -0,0 +1,31 @@ +--- +############################################################################## +# Copyright 2017 Parker Berberian and Others # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +############################################################################## + +name: "clean-workflow" +runner_type: "action-chain" +description: "This workflow cleans a host after a deployment" +entry_point: "workflows/clean-workflow.yaml" +enabled: true +parameters: + host: + type: "string" + required: true + description: "hostname of host to be cleaned" + key: + type: "string" + required: false + description: "st2 key of vpn user to delete" diff --git a/laas-fog/pharoslaas/actions/deployment_workflow.yaml b/laas-fog/pharoslaas/actions/deployment_workflow.yaml new file mode 100644 index 0000000..659b7e2 --- /dev/null +++ b/laas-fog/pharoslaas/actions/deployment_workflow.yaml @@ -0,0 +1,39 @@ +--- +############################################################################## +# Copyright 2017 Parker Berberian and Others # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +############################################################################## + +description: This is the workflow that will provision the host as requested. +enabled: true +runner_type: mistral-v2 +entry_point: workflows/deployment_workflow.yaml +name: deployment_workflow +pack: pharoslaas +parameters: + installer: + required: true + type: string + host: + required: true + type: string + scenario: + required: false + type: string + os: + required: false + type: string + booking: + required: false + type: string diff --git a/laas-fog/pharoslaas/actions/workflows/clean-workflow.yaml b/laas-fog/pharoslaas/actions/workflows/clean-workflow.yaml new file mode 100644 index 0000000..c0a13e7 --- /dev/null +++ b/laas-fog/pharoslaas/actions/workflows/clean-workflow.yaml @@ -0,0 +1,16 @@ +--- +chain: + - + name: "image" + ref: "pharoslaas.fog_imageWorkflow" + parameters: + host: "{{host}}" + on-success: "delete_vpn_user" + + - + name: "delete_vpn_user" + ref: "pharoslaas.vpn_delete_user" + parameters: + key: "{{key}}" + +default: "image" diff --git a/laas-fog/pharoslaas/actions/workflows/deployment_workflow.yaml b/laas-fog/pharoslaas/actions/workflows/deployment_workflow.yaml new file mode 100644 index 0000000..c32d60d --- /dev/null +++ b/laas-fog/pharoslaas/actions/workflows/deployment_workflow.yaml @@ -0,0 +1,47 @@ +--- +version: '2.0' +pharoslaas.deployment_workflow: + description: The master workflow to provision, install, deploy hosts + input: + - host + - installer + - scenario + - os + - booking + tasks: + image_host: + action: pharoslaas.fog_imageWorkflow host=<% $.host %> os=<% $.os %> + on-success: + - install_fuel: <% $.installer = 'Fuel' %> + - install_joid: <% $.installer = 'Joid' %> + - install_apex: <% $.installer = 'Apex' %> + - install_compass: <% $.installer = 'Compass' %> + - change_password: <% not $.installer in list('Fuel','Joid','Apex','Compass') %> + + install_fuel: + action: pharoslaas.fuel_workflow host=<% $.host %> scenario=<% $.scenario %> + on-success: + - change_password + + install_joid: + action: pharoslaas.joid_workflow host=<% $.host %> scenario=<% $.scenario %> + on-success: + - change_password + + install_apex: + action: pharoslaas.apex_workflow host=<% $.host %> scenario=<% $.scenario %> + on-success: + - change_password + + install_compass: + action: pharoslaas.compass_workflow host=<% $.host %> scenario=<% $.scenario %> + on-success: + - change_password + + change_password: + action: pharoslaas.password_workflow host=<% $.host %> + on-success: + - make_vpn_user + + make_vpn_user: + action: pharoslaas.vpn_make_user booking=<% $.booking %> -- 2.16.6