0dad3e3b4c1995a97c658d503a03b65b93fc4dad
[apex.git] / build / kvm4nfv-1st-boot.yaml
1 heat_template_version: 2014-10-16
2
3 description: >
4   This is the firstboot configuration for kvmfornfv kernel of the compute nodes
5   via cloud-init. To enable this, replace the default
6   mapping of OS::TripleO::NodeUserData in ../overcloud_resource_registry*
7
8 parameters:
9   ComputeKernelArgs:
10     description: >
11       Name of the kvmfornfv kernel rpm.
12       Example: "kvmfornfv_kernel.rpm"
13     type: string
14     default: ""
15   ComputeHostnameFormat:
16     type: string
17     default: ""
18
19 resources:
20   userdata:
21     type: OS::Heat::MultipartMime
22     properties:
23       parts:
24       - config: {get_resource: compute_kernel_args}
25
26   # Verify the logs on /var/log/cloud-init.log on the overcloud node
27   compute_kernel_args:
28     type: OS::Heat::SoftwareConfig
29     properties:
30       config:
31         str_replace:
32           template: |
33             #!/bin/bash
34             set -x
35             FORMAT=$COMPUTE_HOSTNAME_FORMAT
36             if [[ -z $FORMAT ]] ; then
37               FORMAT="compute" ;
38             else
39               # Assumption: only %index% and %stackname% are the variables in Host name format
40               FORMAT=$(echo $FORMAT | sed  's/\%index\%//g' | sed 's/\%stackname\%//g') ;
41             fi
42             if [[ $(hostname) == *$FORMAT* ]] ; then
43               yum install -y /root/$KVMFORNFV_KERNEL_RPM
44               grub2-mkconfig -o /etc/grub2.cfg
45               sleep 5
46               reboot
47             fi
48           params:
49             $KVMFORNFV_KERNEL_RPM: {get_param: ComputeKernelArgs}
50             $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat}
51
52 outputs:
53   # This means get_resource from the parent template will get the userdata, see:
54   # http://docs.openstack.org/developer/heat/template_guide/composition.html#making-your-template-resource-more-transparent
55   # Note this is new-for-kilo, an alternative is returning a value then using
56   # get_attr in the parent template instead.
57   OS::stack_id:
58     value: {get_resource: userdata}
59
60