Add pre-network hook and example showing config-then-reboot
There are some requirements for early configuration that involves e.g setting kernel parameters then rebooting. Currently this can be done via cloud-init, e.g firstboot templates, but there's been discussion around enabling a SoftwareDeployment approach instead. The main advantage of doing it this way is there's an error path if something goes wrong with the config (except triggering the reboot as we have to use NO_SIGNAL for that). Change-Id: Ia54ee654f755631b8062eb5c209a60c6f9161500
This commit is contained in:
parent
713a0326e4
commit
f1cc214384
48
extraconfig/pre_network/config_then_reboot.yaml
Normal file
48
extraconfig/pre_network/config_then_reboot.yaml
Normal file
@ -0,0 +1,48 @@
|
||||
heat_template_version: 2014-10-16
|
||||
|
||||
description: >
|
||||
Do some configuration, then reboot - sometimes needed for early-boot
|
||||
changes such as modifying kernel configuration
|
||||
|
||||
parameters:
|
||||
server:
|
||||
type: string
|
||||
|
||||
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: ['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: ['CREATE'] # Only do this on CREATE
|
||||
signal_transport: NO_SIGNAL
|
@ -11,6 +11,7 @@ resource_registry:
|
||||
OS::TripleO::Tasks::PackageUpdate: extraconfig/tasks/yum_update.yaml
|
||||
|
||||
{% for role in roles %}
|
||||
OS::TripleO::{{role.name}}::PreNetworkConfig: OS::Heat::None
|
||||
OS::TripleO::{{role.name}}PostDeploySteps: puppet/post.yaml
|
||||
OS::TripleO::{{role.name}}: puppet/{{role.name.lower()}}-role.yaml
|
||||
OS::TripleO::{{role.name}}Config: puppet/{{role.name.lower()}}-config.yaml
|
||||
|
@ -307,8 +307,14 @@ resources:
|
||||
- - {get_attr: [BlockStorage, name]}
|
||||
- ctlplane
|
||||
|
||||
PreNetworkConfig:
|
||||
type: OS::TripleO::BlockStorage::PreNetworkConfig
|
||||
properties:
|
||||
server: {get_resource: BlockStorage}
|
||||
|
||||
NetworkDeployment:
|
||||
type: OS::TripleO::SoftwareDeployment
|
||||
depends_on: PreNetworkConfig
|
||||
properties:
|
||||
name: NetworkDeployment
|
||||
config: {get_resource: NetworkConfig}
|
||||
|
@ -313,8 +313,14 @@ resources:
|
||||
- - {get_attr: [CephStorage, name]}
|
||||
- ctlplane
|
||||
|
||||
PreNetworkConfig:
|
||||
type: OS::TripleO::CephStorage::PreNetworkConfig
|
||||
properties:
|
||||
server: {get_resource: CephStorage}
|
||||
|
||||
NetworkDeployment:
|
||||
type: OS::TripleO::SoftwareDeployment
|
||||
depends_on: PreNetworkConfig
|
||||
properties:
|
||||
name: NetworkDeployment
|
||||
config: {get_resource: NetworkConfig}
|
||||
|
@ -316,6 +316,11 @@ resources:
|
||||
- - {get_attr: [NovaCompute, name]}
|
||||
- ctlplane
|
||||
|
||||
PreNetworkConfig:
|
||||
type: OS::TripleO::Compute::PreNetworkConfig
|
||||
properties:
|
||||
server: {get_resource: NovaCompute}
|
||||
|
||||
NetworkConfig:
|
||||
type: OS::TripleO::Compute::Net::SoftwareConfig
|
||||
properties:
|
||||
@ -329,6 +334,7 @@ resources:
|
||||
|
||||
NetworkDeployment:
|
||||
type: OS::TripleO::SoftwareDeployment
|
||||
depends_on: PreNetworkConfig
|
||||
properties:
|
||||
name: NetworkDeployment
|
||||
config: {get_resource: NetworkConfig}
|
||||
|
@ -335,6 +335,11 @@ resources:
|
||||
- - {get_attr: [Controller, name]}
|
||||
- ctlplane
|
||||
|
||||
PreNetworkConfig:
|
||||
type: OS::TripleO::Controller::PreNetworkConfig
|
||||
properties:
|
||||
server: {get_resource: Controller}
|
||||
|
||||
NetworkConfig:
|
||||
type: OS::TripleO::Controller::Net::SoftwareConfig
|
||||
properties:
|
||||
@ -348,6 +353,7 @@ resources:
|
||||
|
||||
NetworkDeployment:
|
||||
type: OS::TripleO::SoftwareDeployment
|
||||
depends_on: PreNetworkConfig
|
||||
properties:
|
||||
name: NetworkDeployment
|
||||
config: {get_resource: NetworkConfig}
|
||||
|
@ -307,8 +307,14 @@ resources:
|
||||
- - {get_attr: [SwiftStorage, name]}
|
||||
- ctlplane
|
||||
|
||||
PreNetworkConfig:
|
||||
type: OS::TripleO::ObjectStorage::PreNetworkConfig
|
||||
properties:
|
||||
server: {get_resource: SwiftStorage}
|
||||
|
||||
NetworkDeployment:
|
||||
type: OS::TripleO::SoftwareDeployment
|
||||
depends_on: PreNetworkConfig
|
||||
properties:
|
||||
name: NetworkDeployment
|
||||
config: {get_resource: NetworkConfig}
|
||||
|
@ -325,8 +325,14 @@ resources:
|
||||
- - {get_attr: [{{role}}, name]}
|
||||
- ctlplane
|
||||
|
||||
PreNetworkConfig:
|
||||
type: OS::TripleO::{{role}}::PreNetworkConfig
|
||||
properties:
|
||||
server: {get_resource: {{role}}}}
|
||||
|
||||
NetworkDeployment:
|
||||
type: OS::TripleO::SoftwareDeployment
|
||||
depends_on: PreNetworkConfig
|
||||
properties:
|
||||
name: NetworkDeployment
|
||||
config: {get_resource: NetworkConfig}
|
||||
|
Loading…
Reference in New Issue
Block a user