File: migrate_vm_workflow.yaml.j2

package info (click to toggle)
vmms 0.0.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 280 kB
  • sloc: python: 1,494; sh: 82; makefile: 45
file content (46 lines) | stat: -rw-r--r-- 985 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
version: '2.0'

migrate_vm:
  type: direct
  input:
    - vm_id
    - command_timeout: 3600
  concurrency: 3

  output:
    stdout: <% $.ssh_stdout %>

  tasks:
    execute_command:
      action: std.ssh
      input:
        host: "{{ ssh_host }}"
        username: "{{ ssh_username }}"
        private_key: |
{{ ssh_private_key }}
        cmd: "{{ script_path }} <% $.vm_id %>"
        return_result_on_error: true
      on-complete:
        - collect_output

    collect_output:
      action: std.noop
      publish:
        ssh_stdout: <% task(execute_command).result.stdout %>
        exit_code: <% task(execute_command).result.exit_code %>
      on-complete:
        - decision_task

    decision_task:
      action: std.echo
      input:
        output: "Checking exit code..."
      on-success:
        - log_completion: <% $.exit_code = 0 %>
        - fail_workflow: <% $.exit_code != 0 %>

    fail_workflow:
      action: std.fail

    log_completion:
      action: std.noop