File: update_kernel.yaml

package info (click to toggle)
mistral-extra 15.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 672 kB
  • sloc: python: 2,600; sh: 40; makefile: 18
file content (42 lines) | stat: -rw-r--r-- 1,191 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
---
version: '2.0'

upgrade_kernel_on_vms:
  input:
    - private_key_filename
    - gateway_host
    - vm_ids: null
    - username: ubuntu

  tasks:
    schedule_upgrade:
      on-success:
        - get_hosts: <% $.vm_ids != null %>
        - get_vms: <% $.vm_ids = null %>

    get_vms:
      action: nova.servers_list
      publish:
        vm_ids: <% task(get_vms).result.id %>
      keep-result: false
      on-success:
        - get_hosts

    get_hosts:
      with-items: id in <% $.vm_ids %>
      action: nova.servers_get server=<% $.id %>
      publish:
        hosts: <% task(get_hosts).result.select({ip => $.addresses.get($.addresses.keys().first()).where($.get("OS-EXT-IPS:type") = fixed).first().addr}).ip %>
      keep-result: false
      on-success:
        - upgrade_vm

    upgrade_vm: # Works for ubuntu
      with-items: host in <% $.hosts %>
      action: std.ssh_proxied
      input:
        host: <% $.host %>
        gateway_host: <% $.gateway_host %>
        private_key_filename: <% $.private_key_filename %>
        username: <% $.username %>
        cmd: "sudo apt-get update && sudo apt-get install linux-image-generic-lts-$(lsb_release -sc) -y && sudo reboot"