summaryrefslogtreecommitdiffstats
path: root/extraconfig/pre_network/config_then_reboot.yaml
blob: 79cb7cbcfc5c22f3172373d53fa88943e2a770ef (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
heat_template_version: pike

description: >
  Do some configuration, then reboot - sometimes needed for early-boot
  changes such as modifying kernel configuration

parameters:
  server:
    type: string
  deployment_actions:
    default: ['CREATE', 'UPDATE']
    type: comma_delimited_list
    description: >
      List of stack actions that will trigger any deployments in this
      templates. The actions will be an empty list of the server is in the
      toplevel DeploymentServerBlacklist parameter's value.

conditions:
  deployment_actions_empty:
    equals:
      - {get_param: deployment_actions}
      - []

resources:

  SomeConfig:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      config: |
        #!/bin/bash
        echo "did some config before reboot" > /root/pre-reboot-config

  SomeDeployment:
    type: OS::Heat::SoftwareDeployment
    properties:
      name: SomeDeployment
      server:  {get_param: server}
      config: {get_resource: SomeConfig}
      actions:
        if:
          - deployment_actions_empty
          - []
          - ['CREATE'] # Only do this on CREATE
      actions: ['CREATE'] # Only do this on CREATE

  RebootConfig:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      config: |
        #!/bin/bash
        # Stop os-collect-config to avoid any race collecting another
        # deployment before reboot happens
        systemctl stop os-collect-config.service
        /sbin/reboot

  RebootDeployment:
    type: OS::Heat::SoftwareDeployment
    depends_on: SomeDeployment
    properties:
      name: RebootDeployment
      server:  {get_param: server}
      config: {get_resource: RebootConfig}
      actions:
        if:
          - deployment_actions_empty
          - []
          - ['CREATE'] # Only do this on CREATE
      signal_transport: NO_SIGNAL