summaryrefslogtreecommitdiffstats
path: root/extraconfig/pre_network
diff options
context:
space:
mode:
authorSteven Hardy <shardy@redhat.com>2016-12-15 10:09:35 +0000
committerSteven Hardy <shardy@redhat.com>2016-12-15 11:12:37 +0000
commitf1cc2143842e869c97aed5f777c0ec1144d0d132 (patch)
tree48618c87b06d24344f9814e118044cc0d895dfa9 /extraconfig/pre_network
parent713a0326e4d0ffbd4531263b7bd638809c2a639c (diff)
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
Diffstat (limited to 'extraconfig/pre_network')
-rw-r--r--extraconfig/pre_network/config_then_reboot.yaml48
1 files changed, 48 insertions, 0 deletions
diff --git a/extraconfig/pre_network/config_then_reboot.yaml b/extraconfig/pre_network/config_then_reboot.yaml
new file mode 100644
index 00000000..ec4d2761
--- /dev/null
+++ b/extraconfig/pre_network/config_then_reboot.yaml
@@ -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