--- version: '2.0' name: tripleo.deployment.v1 description: TripleO deployment workflows workflows: deploy_on_server: input: - server_uuid - server_name - config - config_name - group - queue_name: tripleo tags: - tripleo-common-managed tasks: deploy_config: action: tripleo.deployment.config on-complete: send_message input: server_id: <% $.server_uuid %> name: <% $.config_name %> config: <% $.config %> group: <% $.group %> publish: stdout: <% task().result.deploy_stdout %> stderr: <% task().result.deploy_stderr %> status_code: <% task().result.deploy_status_code %> publish-on-error: status: FAILED message: <% task().result %> send_message: workflow: tripleo.messaging.v1.send input: queue_name: <% $.queue_name %> type: <% execution().name %> execution: <% execution() %> status: <% $.get("status", "SUCCESS") %> message: <% $.get("message", "") %> payload: server_uuid: <% $.server_uuid %> server_name: <% $.server_name %> config_name: <% $.config_name %> status_code: <% $.get("status_code", "") %> stdout: <% $.get("stdout", "") %> stderr: <% $.get("stderr", "") %> deploy_on_servers: input: - server_name - config_name - config - group: script - queue_name: tripleo tags: - tripleo-common-managed tasks: check_if_all_servers: on-success: - get_servers_matching: <% $.server_name != "all" %> - get_all_servers: <% $.server_name = "all" %> get_servers_matching: action: nova.servers_list on-success: deploy_on_servers publish: servers_with_name: <% task().result._info.where($.name.indexOf(execution().input.server_name) > -1) %> get_all_servers: action: nova.servers_list on-success: deploy_on_servers publish: servers_with_name: <% task().result._info %> deploy_on_servers: on-success: send_success_message on-error: send_failed_message with-items: server in <% $.servers_with_name %> workflow: tripleo.deployment.v1.deploy_on_server input: server_name: <% $.server.name %> server_uuid: <% $.server.id %> config: <% $.config %> config_name: <% $.config_name %> group: <% $.group %> queue_name: <% $.queue_name %> send_success_message: workflow: tripleo.messaging.v1.send input: queue_name: <% $.queue_name %> type: <% execution().name %> status: SUCCESS execution: <% execution() %> send_failed_message: workflow: tripleo.messaging.v1.send input: queue_name: <% $.queue_name %> type: <% execution().name %> status: FAILED execution: <% execution() %> message: <% task(deploy_on_servers).result %> deploy_plan: description: > Deploy the overcloud for a plan. input: - container - run_validations: False - timeout: 240 - skip_deploy_identifier: False - queue_name: tripleo tags: - tripleo-common-managed tasks: send_start_message: workflow: tripleo.messaging.v1.send input: queue_name: <% $.queue_name %> type: <% execution().name %> status: RUNNING deployment_status: DEPLOYING message: "Workflow Started" execution: <% execution() %> plan_name: <% $.container %> on-complete: add_validation_ssh_key add_validation_ssh_key: workflow: tripleo.validations.v1.add_validation_ssh_key_parameter input: container: <% $.container %> queue_name: <% $.queue_name %> on-complete: - run_validations: <% $.run_validations %> - create_swift_rings_backup_plan: <% not $.run_validations %> run_validations: workflow: tripleo.validations.v1.run_groups input: group_names: - 'pre-deployment' plan: <% $.container %> queue_name: <% $.queue_name %> publish-on-error: message: <% task().result %> on-success: create_swift_rings_backup_plan on-error: set_deployment_failed create_swift_rings_backup_plan: workflow: tripleo.swift_rings_backup.v1.create_swift_rings_backup_container_plan input: container: <% $.container %> queue_name: <% $.queue_name %> use_default_templates: true publish-on-error: message: <% task().result %> on-success: cell_v2_discover_hosts on-error: set_deployment_failed cell_v2_discover_hosts: action: tripleo.baremetal.cell_v2_discover_hosts publish-on-error: message: <% task().result %> on-success: deploy on-error: set_deployment_failed deploy: action: tripleo.deployment.deploy input: timeout: <% $.timeout %> container: <% $.container %> skip_deploy_identifier: <% $.skip_deploy_identifier %> publish-on-error: message: <% task().result %> on-success: set_deployment_success on-error: set_deployment_failed set_deployment_failed: on-success: send_message publish: status: FAILED deployment_status: DEPLOY_FAILED set_deployment_success: on-success: send_message publish: status: SUCCESS deployment_status: DEPLOY_SUCCESS send_message: workflow: tripleo.messaging.v1.send input: queue_name: <% $.queue_name %> type: <% execution().name %> status: <% $.status %> message: <% $.get('message', '') %> execution: <% execution() %> plan_name: <% $.container %> deployment_status: <% $.deployment_status %> get_horizon_url: description: > Retrieve the Horizon URL from the Overcloud stack. input: - stack: overcloud - queue_name: tripleo tags: - tripleo-common-managed output: horizon_url: <% $.horizon_url %> tasks: get_horizon_url: action: heat.stacks_get input: stack_id: <% $.stack %> publish: horizon_url: <% task().result.outputs.where($.output_key = "EndpointMap").output_value.HorizonPublic.uri.single() %> on-success: send_message publish-on-error: status: FAILED message: <% task().result %> send_message: workflow: tripleo.messaging.v1.send input: queue_name: <% $.queue_name %> type: <% execution().name %> status: <% $.get('status', 'SUCCESS') %> execution: <% execution() %> message: <% $.get('message', '') %> payload: horizon_url: <% $.get('horizon_url', '') %> config_download_deploy: description: > Configure the overcloud with config-download. input: - timeout: 240 - queue_name: tripleo - plan_name: overcloud - work_dir: /var/lib/mistral - verbosity: 1 - blacklist: [] tags: - tripleo-common-managed tasks: get_blacklisted_hostnames: action: heat.stacks_output_show input: stack_id: <% $.plan_name %> output_key: BlacklistedHostnames publish: blacklisted_hostnames: <% task().result.output.output_value.where($ != "") %> on-success: get_config on-error: send_message publish-on-error: status: FAILED message: <% task().result %> deployment_status: DEPLOY_FAILED get_config: action: tripleo.config.get_overcloud_config input: container: <% $.get('plan_name') %> on-success: download_config on-error: send_message publish-on-error: status: FAILED message: <% task().result %> deployment_status: DEPLOY_FAILED download_config: action: tripleo.config.download_config input: work_dir: <% $.get('work_dir') %>/<% execution().id %> on-success: send_msg_config_download on-error: send_message publish-on-error: status: FAILED message: <% task().result %> deployment_status: DEPLOY_FAILED send_msg_config_download: workflow: tripleo.messaging.v1.send input: queue_name: <% $.queue_name %> type: <% execution().name %> status: <% $.get('status', 'RUNNING') %> deployment_status: DEPLOYING execution: <% execution() %> message: Config downloaded at <% $.get('work_dir') %>/<% execution().id %> plan_name: <% $.plan_name %> on-success: get_private_key get_private_key: action: tripleo.validations.get_privkey publish: private_key: <% task().result %> on-success: generate_inventory on-error: send_message publish-on-error: status: FAILED message: <% task().result %> deployment_status: DEPLOY_FAILED generate_inventory: action: tripleo.ansible-generate-inventory input: ansible_ssh_user: tripleo-admin work_dir: <% $.get('work_dir') %>/<% execution().id %> plan_name: <% $.get('plan_name') %> publish: inventory: <% task().result %> on-success: send_msg_generate_inventory on-error: send_message publish-on-error: status: FAILED message: <% task().result %> deployment_status: DEPLOY_FAILED send_msg_generate_inventory: workflow: tripleo.messaging.v1.send input: queue_name: <% $.queue_name %> type: <% execution().name %> status: <% $.get('status', 'RUNNING') %> deployment_status: DEPLOYING execution: <% execution() %> message: Inventory generated at <% $.get('inventory') %> plan_name: <% $.plan_name %> on-success: send_msg_run_ansible send_msg_run_ansible: workflow: tripleo.messaging.v1.send input: queue_name: <% $.queue_name %> type: <% execution().name %> status: <% $.get('status', 'RUNNING') %> deployment_status: DEPLOYING execution: <% execution() %> plan_name: <% $.plan_name %> message: > Running ansible playbook at <% $.get('work_dir') %>/<% execution().id %>/deploy_steps_playbook.yaml. See log file at <% $.get('work_dir') %>/<% execution().id %>/ansible.log for progress. ... on-success: run_ansible run_ansible: action: tripleo.ansible-playbook input: inventory: <% $.inventory %> playbook: <% $.get('work_dir') %>/<% execution().id %>/deploy_steps_playbook.yaml remote_user: tripleo-admin ssh_extra_args: '-o StrictHostKeyChecking=no' ssh_private_key: <% $.private_key %> use_openstack_credentials: true verbosity: <% $.get('verbosity') %> become: true timeout: <% $.timeout %> work_dir: <% $.get('work_dir') %>/<% execution().id %> queue_name: <% $.queue_name %> reproduce_command: true trash_output: true blacklisted_hostnames: <% $.blacklisted_hostnames %> execution_id: <% execution().id %> publish: log_path: <% task(run_ansible).result.get('log_path') %> deployment_status: DEPLOY_SUCCESS on-success: - ansible_passed: <% task().result.returncode = 0 %> - ansible_failed: <% task().result.returncode != 0 %> on-error: send_message publish-on-error: status: FAILED message: Ansible failed, check log at <% $.get('work_dir') %>/<% execution().id %>/ansible.log. deployment_status: DEPLOY_FAILED ansible_passed: on-success: send_message publish: status: SUCCESS message: Ansible passed. deployment_status: DEPLOY_SUCCESS ansible_failed: on-success: send_message publish: status: FAILED message: Ansible failed, check log at <% $.get('work_dir') %>/<% execution().id %>/ansible.log. deployment_status: DEPLOY_FAILED send_message: workflow: tripleo.messaging.v1.send input: queue_name: <% $.queue_name %> type: <% execution().name %> status: <% $.get('status', 'SUCCESS') %> execution: <% execution() %> message: <% $.get('message', '') %> plan_name: <% $.plan_name %> deployment_status: <% $.deployment_status %> get_deployment_status: description: > Get deployment status tags: - tripleo-common-managed input: - plan: overcloud - queue_name: tripleo output: deployment_status: <% $.deployment_status %> tasks: get_deployment_status: action: swift.get_object input: container: <% $.plan %>-messages obj: deployment_status.yaml publish: deployment_status: <% yaml_parse(task().result.last()) %> on-complete: send_message publish-on-error: message: No deployment status found for plan <% $.plan %> deployment_status: "" send_message: workflow: tripleo.messaging.v1.send input: queue_name: <% $.queue_name %> type: <% execution().name %> execution: <% execution() %> status: <% $.get("status", "SUCCESS") %> message: <% $.get("message", "") %> payload: deployment_status: <% $.get(deployment_status, "") %> get_deployment_failures: description: > Get deployment failures tags: - tripleo-common-managed input: - plan: overcloud - queue_name: tripleo output: deployment_failures: <% $.deployment_failures %> tasks: get_deployment_failures: action: tripleo.deployment.get_deployment_failures input: plan: <% $.plan %> publish: deployment_failures: <% task().result %> on-complete: send_message publish-on-error: status: FAILED message: <% task().result %> send_message: workflow: tripleo.messaging.v1.send input: queue_name: <% $.queue_name %> type: <% execution().name %> execution: <% execution() %> status: <% $.get("status", "SUCCESS") %> message: <% $.get("message", "") %> payload: deployment_failures: <% $.get(deployment_failures, "") %>