tripleo-heat-templates/extraconfig/pre_network/host_config_and_reboot.yaml

105 lines
3.0 KiB
YAML

heat_template_version: pike
description: >
All configurations which require reboot should be initiated via PreNetworkConfig. After
this configuration is completed, the corresponding node will be rebooted.
parameters:
server:
type: string
RoleParameters:
type: json
description: Role Specific parameters
default: {}
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:
is_host_config_required: {not: {equals: [{get_param: [RoleParameters, KernelArgs]}, ""]}}
deployment_actions_empty:
equals:
- {get_param: deployment_actions}
- []
resources:
HostParametersConfig:
type: OS::Heat::SoftwareConfig
condition: is_host_config_required
properties:
group: ansible
inputs:
- name: _KERNEL_ARGS_
- name: _TUNED_PROFILE_NAME_
- name: _TUNED_CORES_
outputs:
- name: result
config:
get_file: ansible_host_config.yaml
HostParametersDeployment:
type: OS::Heat::SoftwareDeployment
condition: is_host_config_required
properties:
name: HostParametersDeployment
server: {get_param: server}
config: {get_resource: HostParametersConfig}
actions:
if:
- deployment_actions_empty
- []
- ['CREATE'] # Only do this on CREATE
input_values:
_KERNEL_ARGS_: {get_param: [RoleParameters, KernelArgs]}
_TUNED_PROFILE_NAME_: {get_param: [RoleParameters, TunedProfileName]}
_TUNED_CORES_: {get_param: [RoleParameters, HostIsolatedCoreList]}
RebootConfig:
type: OS::Heat::SoftwareConfig
condition: is_host_config_required
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: HostParametersDeployment
condition: is_host_config_required
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
outputs:
result:
condition: is_host_config_required
value:
get_attr: [HostParametersDeployment, result]
stdout:
condition: is_host_config_required
value:
get_attr: [HostParametersDeployment, deploy_stdout]
stderr:
condition: is_host_config_required
value:
get_attr: [HostParametersDeployment, deploy_stderr]
status_code:
condition: is_host_config_required
value:
get_attr: [HostParametersDeployment, deploy_status_code]