Add sample usage of StorageMgmt network for compute nodes
[apex-tripleo-heat-templates.git] / extraconfig / pre_network / host_config_and_reboot.yaml
1 heat_template_version: pike
2
3 description: >
4   All configurations which require reboot should be initiated via PreNetworkConfig. After
5   this configuration is completed, the corresponding node will be rebooted.
6
7 parameters:
8   server:
9     type: string
10   RoleParameters:
11     type: json
12     description: Role Specific parameters
13     default: {}
14   deployment_actions:
15     default: ['CREATE', 'UPDATE']
16     type: comma_delimited_list
17     description: >
18       List of stack actions that will trigger any deployments in this
19       templates. The actions will be an empty list of the server is in the
20       toplevel DeploymentServerBlacklist parameter's value.
21
22 conditions:
23   is_host_config_required: {not: {equals: [{get_param: [RoleParameters, KernelArgs]}, ""]}}
24   deployment_actions_empty:
25     equals:
26       - {get_param: deployment_actions}
27       - []
28
29 resources:
30   HostParametersConfig:
31     type: OS::Heat::SoftwareConfig
32     condition: is_host_config_required
33     properties:
34       group: ansible
35       inputs:
36         - name: _KERNEL_ARGS_
37         - name: _TUNED_PROFILE_NAME_
38         - name: _TUNED_CORES_
39       outputs:
40         - name: result
41       config:
42         get_file: ansible_host_config.yaml
43
44   HostParametersDeployment:
45     type: OS::Heat::SoftwareDeployment
46     condition: is_host_config_required
47     properties:
48       name: HostParametersDeployment
49       server:  {get_param: server}
50       config: {get_resource: HostParametersConfig}
51       actions:
52         if:
53           - deployment_actions_empty
54           - []
55           - ['CREATE'] # Only do this on CREATE
56       input_values:
57         _KERNEL_ARGS_: {get_param: [RoleParameters, KernelArgs]}
58         _TUNED_PROFILE_NAME_: {get_param: [RoleParameters, TunedProfileName]}
59         _TUNED_CORES_: {get_param: [RoleParameters, HostIsolatedCoreList]}
60
61   RebootConfig:
62     type: OS::Heat::SoftwareConfig
63     condition: is_host_config_required
64     properties:
65       group: script
66       config: |
67         #!/bin/bash
68         # Stop os-collect-config to avoid any race collecting another
69         # deployment before reboot happens
70         systemctl stop os-collect-config.service
71         /sbin/reboot
72
73   RebootDeployment:
74     type: OS::Heat::SoftwareDeployment
75     depends_on: HostParametersDeployment
76     condition: is_host_config_required
77     properties:
78       name: RebootDeployment
79       server:  {get_param: server}
80       config: {get_resource: RebootConfig}
81       actions:
82         if:
83           - deployment_actions_empty
84           - []
85           - ['CREATE'] # Only do this on CREATE
86       signal_transport: NO_SIGNAL
87
88 outputs:
89   result:
90     condition: is_host_config_required
91     value:
92       get_attr: [HostParametersDeployment, result]
93   stdout:
94     condition: is_host_config_required
95     value:
96       get_attr: [HostParametersDeployment, deploy_stdout]
97   stderr:
98     condition: is_host_config_required
99     value:
100       get_attr: [HostParametersDeployment, deploy_stderr]
101   status_code:
102     condition: is_host_config_required
103     value:
104       get_attr: [HostParametersDeployment, deploy_status_code]