-
Notifications
You must be signed in to change notification settings - Fork 14
Convert mistral workflows to orquesta #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,66 +1,70 @@ | ||
| --- | ||
| version: '2.0' | ||
| version: 1.0 | ||
|
|
||
| napalm.configuration_change_workflow: | ||
| description: Configuration Change Workflow | ||
|
|
||
| input: | ||
| - hostname | ||
| - driver | ||
| - message | ||
| - username | ||
|
|
||
| type: direct | ||
| input: | ||
| - hostname | ||
| - driver | ||
| - message | ||
| - username | ||
|
|
||
| task-defaults: | ||
| on-error: | ||
| - notify_on_error | ||
| vars: | ||
| - stdout: "" | ||
| - stderr: "" | ||
|
|
||
| tasks: | ||
| send_detected_email: | ||
| action: core.sendmail | ||
| input: | ||
| to: "<% st2kv('system.napalm_remotebackup_mailto') %>" | ||
| from: "<% st2kv('system.napalm_remotebackup_mailfrom') %>" | ||
| # Will work when this is in the code: https://github.com/StackStorm/st2/pull/3177 | ||
| #subject: "Stackstorm detected a configuration change on <% $.hostname %> {% if _.username %} by {{ _.username }} {% endif %}." | ||
| subject: "Stackstorm detected a configuration change on <% $.hostname %> by <% $.username %>." | ||
| content_type: "text/plain" | ||
| body: "\r\n\r\nThe following syslog triggered this event: <% $.message %>\r\n\r\n" | ||
| on-success: | ||
| - backup_device | ||
| tasks: | ||
| send_detected_email: | ||
| action: core.sendmail | ||
| input: | ||
| to: "{{ st2kv('system.napalm_remotebackup_mailto') }}" | ||
| from: "{{ st2kv('system.napalm_remotebackup_mailfrom') }}" | ||
| subject: "Stackstorm detected a configuration change on {{ ctx('hostname') }} by {{ ctx('username') }}." | ||
| content_type: "text/plain" | ||
| body: "\r\n\r\nThe following syslog triggered this event: {{ ctx('message') }}\r\n\r\n" | ||
| next: | ||
| - when: "{{ succeeded() }}" | ||
| do: backup_device | ||
| - when: "{{ failed() }}" | ||
| do: notify_on_error | ||
|
|
||
| backup_device: | ||
| action: "core.remote" | ||
| wait-before: 60 | ||
| input: | ||
| cmd: "<% st2kv('system.napalm_remotebackup_cmd') %> <% $.hostname %> <% $.driver %>" | ||
| username: "<% st2kv('system.napalm_remotebackup_user') %>" | ||
| private_key: "/home/stanley/.ssh/stanley_rsa" | ||
| hosts: "<% st2kv('system.napalm_remotebackup_host') %>" | ||
| backup_device: | ||
| action: "core.remote" | ||
| input: | ||
| cmd: "{{ st2kv('system.napalm_remotebackup_cmd') }} {{ ctx('hostname') }} {{ ctx('driver') }}" | ||
| username: "{{ st2kv('system.napalm_remotebackup_user') }}" | ||
| private_key: "/home/stanley/.ssh/stanley_rsa" | ||
| hosts: "{{ st2kv('system.napalm_remotebackup_host') }}" | ||
| next: | ||
| - when: "{{ succeeded() }}" | ||
| publish: | ||
| stdout: <% task(backup_device).result.get(st2kv('system.napalm_remotebackup_host')).stdout %> | ||
| stderr: <% task(backup_device).result.get(st2kv('system.napalm_remotebackup_host')).stderr %> | ||
| on-success: | ||
| - send_complete_email | ||
| - stdout: "{{ result()[st2kv('system.napalm_remotebackup_host')].stdout }}" | ||
| - sterr: "{{ result()[st2kv('system.napalm_remotebackup_host')].stdout }}" | ||
| do: send_complete_email | ||
| - when: "{{ failed() }}" | ||
| do: notify_on_error | ||
|
|
||
| send_complete_email: | ||
| action: core.sendmail | ||
| input: | ||
| to: "<% st2kv('system.napalm_remotebackup_mailto') %>" | ||
| from: "<% st2kv('system.napalm_remotebackup_mailfrom') %>" | ||
| subject: "Stackstorm completed a backup of <% $.hostname %>." | ||
| content_type: "text/plain" | ||
| body: "\r\nThe following syslog triggered this event: <% $.message %>\r\n\r\n | ||
| \r\n<% $.stderr %>\r\n | ||
| \r\n<% $.stdout %>\r\n | ||
| \r\n\r\n" | ||
| send_complete_email: | ||
| action: core.sendmail | ||
| input: | ||
| to: "{{ st2kv('system.napalm_remotebackup_mailto') }}" | ||
| from: "{{ st2kv('system.napalm_remotebackup_mailfrom') }}" | ||
| subject: "Stackstorm completed a backup of {{ ctx('hostname') }}." | ||
| content_type: "text/plain" | ||
| body: "\r\nThe following syslog triggered this event: {{ ctx('message') }}\r\n\r\n | ||
| \r\n{{ ctx('stderr') }}\r\n | ||
| \r\n{{ ctx('stdout') }}\r\n | ||
| \r\n\r\n" | ||
|
|
||
| notify_on_error: | ||
| action: core.sendmail | ||
| input: | ||
| to: "{{ st2kv('system.napalm_actionerror_mailto') }}" | ||
| from: "{{ st2kv('system.napalm_actionerror_mailfrom') }}" | ||
| subject: "Stackstorm device backup workflow error" | ||
| body: "Something went wrong with the device backup workflow. Check stackstorm for the error. Execution ID {{ ctx('st2').action_execution_id }}\r\n\r\n" | ||
| next: | ||
| - do: fail | ||
|
|
||
| notify_on_error: | ||
| action: core.sendmail | ||
| input: | ||
| to: "<% st2kv('system.napalm_actionerror_mailto') %>" | ||
| from: "<% st2kv('system.napalm_actionerror_mailfrom') %>" | ||
| subject: "Stackstorm device backup workflow error" | ||
| body: "Something went wrong with the device backup workflow. Check stackstorm for the error. Execution ID <% env().st2_execution_id %>\r\n\r\n" | ||
| on-complete: | ||
| - fail | ||
| output: | ||
| - stdout: "{{ ctx('stdout') }}" | ||
| - stderr: "{{ ctx('stderr') }}" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.