Merge "Add sample usage of StorageMgmt network for compute nodes"
[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
23 parameter_group:
24   - label: deprecated
25     parameters:
26       - {{role}}KernelArgs
27       - {{role}}TunedProfileName
28       - {{role}}HostCpusList
29
30 conditions:
31   param_exists:
32     or:
33       - not:
34           equals:
35           - get_param: {{role}}KernelArgs
36           - ""
37       - not:
38           equals:
39           - get_param: {{role}}TunedProfileName
40           - ""
41
42 resources:
43
44   HostParametersConfig:
45     type: OS::Heat::SoftwareConfig
46     condition: param_exists
47     properties:
48       group: ansible
49       inputs:
50         - name: _KERNEL_ARGS_
51         - name: _TUNED_PROFILE_NAME_
52         - name: _HOST_CPUS_LIST_
53       outputs:
54         - name: result
55       config:
56         get_file: ansible_host_config.ansible
57
58   HostParametersDeployment:
59     type: OS::Heat::SoftwareDeployment
60     condition: param_exists
61     properties:
62       name: HostParametersDeployment
63       server:  {get_param: server}
64       config: {get_resource: HostParametersConfig}
65       actions: ['CREATE'] # Only do this on CREATE
66       input_values:
67         _KERNEL_ARGS_: {get_param: {{role}}KernelArgs}
68         _TUNED_PROFILE_NAME_: {get_param: {{role}}TunedProfileName}
69         _HOST_CPUS_LIST_: {get_param: {{role}}HostCpusList}
70
71   RebootConfig:
72     type: OS::Heat::SoftwareConfig
73     condition: param_exists
74     properties:
75       group: script
76       config: |
77         #!/bin/bash
78         # Stop os-collect-config to avoid any race collecting another
79         # deployment before reboot happens
80         systemctl stop os-collect-config.service
81         /sbin/reboot
82
83   RebootDeployment:
84     type: OS::Heat::SoftwareDeployment
85     condition: param_exists
86     depends_on: HostParametersDeployment
87     properties:
88       name: RebootDeployment
89       server:  {get_param: server}
90       config: {get_resource: RebootConfig}
91       actions: ['CREATE'] # Only do this on CREATE
92       signal_transport: NO_SIGNAL
93
94 outputs:
95   result:
96     value:
97       get_attr: [HostParametersDeployment, result]
98     condition: param_exists
99   stdout:
100     value:
101       get_attr: [HostParametersDeployment, deploy_stdout]
102     condition: param_exists
103   stderr:
104     value:
105       get_attr: [HostParametersDeployment, deploy_stderr]
106     condition: param_exists
107   status_code:
108     value:
109       get_attr: [HostParametersDeployment, deploy_status_code]
110     condition: param_exists