Merge "Tolerate network errors in pingtest retry logic"
[apex-tripleo-heat-templates.git] / extraconfig / pre_network / host_config_and_reboot.role.j2.yaml
1 heat_template_version: pike
2
3 description: >
4   Do some configuration, then reboot - sometimes needed for early-boot
5   changes such as modifying kernel configuration
6
7 parameters:
8   server:
9     type: string
10   # Deprecated Parameters, these configuration are deprecated in favor or role-specific parameters.
11   # Use: extraconfig/pre_network/host_config_and_reboot.yaml.
12   # Deprecated in Pike and will be removed in Queens.
13   {{role}}KernelArgs:
14     type: string
15     default: ""
16   {{role}}TunedProfileName:
17     type: string
18     default: ""
19   {{role}}HostCpusList:
20     type: string
21     default: ""
22   deployment_actions:
23     default: ['CREATE', 'UPDATE']
24     type: comma_delimited_list
25     description: >
26       List of stack actions that will trigger any deployments in this
27       templates. The actions will be an empty list of the server is in the
28       toplevel DeploymentServerBlacklist parameter's value.
29
30 parameter_group:
31   - label: deprecated
32     parameters:
33       - {{role}}KernelArgs
34       - {{role}}TunedProfileName
35       - {{role}}HostCpusList
36
37 conditions:
38   param_exists:
39     or:
40       - not:
41           equals:
42           - get_param: {{role}}KernelArgs
43           - ""
44       - not:
45           equals:
46           - get_param: {{role}}TunedProfileName
47           - ""
48   deployment_actions_empty:
49     equals:
50       - {get_param: deployment_actions}
51       - []
52
53 resources:
54
55   HostParametersConfig:
56     type: OS::Heat::SoftwareConfig
57     condition: param_exists
58     properties:
59       group: ansible
60       inputs:
61         - name: _KERNEL_ARGS_
62         - name: _TUNED_PROFILE_NAME_
63         - name: _HOST_CPUS_LIST_
64       outputs:
65         - name: result
66       config:
67         get_file: ansible_host_config.ansible
68
69   HostParametersDeployment:
70     type: OS::Heat::SoftwareDeployment
71     condition: param_exists
72     properties:
73       name: HostParametersDeployment
74       server:  {get_param: server}
75       config: {get_resource: HostParametersConfig}
76       actions:
77         if:
78           - deployment_actions_empty
79           - []
80           - ['CREATE'] # Only do this on CREATE
81       input_values:
82         _KERNEL_ARGS_: {get_param: {{role}}KernelArgs}
83         _TUNED_PROFILE_NAME_: {get_param: {{role}}TunedProfileName}
84         _HOST_CPUS_LIST_: {get_param: {{role}}HostCpusList}
85
86   RebootConfig:
87     type: OS::Heat::SoftwareConfig
88     condition: param_exists
89     properties:
90       group: script
91       config: |
92         #!/bin/bash
93         # Stop os-collect-config to avoid any race collecting another
94         # deployment before reboot happens
95         systemctl stop os-collect-config.service
96         /sbin/reboot
97
98   RebootDeployment:
99     type: OS::Heat::SoftwareDeployment
100     condition: param_exists
101     depends_on: HostParametersDeployment
102     properties:
103       name: RebootDeployment
104       server:  {get_param: server}
105       config: {get_resource: RebootConfig}
106       actions:
107         if:
108           - deployment_actions_empty
109           - []
110           - ['CREATE'] # Only do this on CREATE
111       signal_transport: NO_SIGNAL
112
113 outputs:
114   result:
115     value:
116       get_attr: [HostParametersDeployment, result]
117     condition: param_exists
118   stdout:
119     value:
120       get_attr: [HostParametersDeployment, deploy_stdout]
121     condition: param_exists
122   stderr:
123     value:
124       get_attr: [HostParametersDeployment, deploy_stderr]
125     condition: param_exists
126   status_code:
127     value:
128       get_attr: [HostParametersDeployment, deploy_status_code]
129     condition: param_exists