Adding yamllint to build checks
[apex.git] / build / first-boot.yaml
1 ---
2 heat_template_version: 2014-10-16
3
4 description: >
5   This is an example showing how you can do firstboot configuration
6   of the nodes via cloud-init.  To enable this, replace the default
7   mapping of OS::TripleO::NodeUserData in ../overcloud_resource_registry*
8
9 parameters:
10   ComputeKernelArgs:
11     description: >
12       Space seprated list of Kernel args to be update to grub.
13       The given args will be appended to existing args of
14       GRUB_CMDLINE_LINUX in file /etc/default/grub
15       Example:
16         "intel_iommu=on default_hugepagesz=2MB hugepagesz=2MB hugepages=2048"
17     type: string
18     default: ""
19
20 resources:
21   userdata:
22     type: OS::Heat::MultipartMime
23     properties:
24       parts:
25         - config: {get_resource: compute_kernel_args}
26
27   # Verify the logs on /var/log/cloud-init.log on the overcloud node
28   compute_kernel_args:
29     type: OS::Heat::SoftwareConfig
30     properties:
31       config:
32         str_replace:
33           template: |
34             #!/bin/bash
35             set -x
36             sed 's/^\(GRUB_CMDLINE_LINUX=".*\)"/\1 $KERNEL_ARGS"/g' \
37                                           -i /etc/default/grub ;
38             grub2-mkconfig -o /etc/grub2.cfg
39             hugepage_count=$(echo $KERNEL_ARGS | \
40                              grep -oP ' ?hugepages=\K[0-9]+')
41             if [ -z "$hugepage_count" ]; then
42               hugepage_count=1024
43             fi
44             echo vm.hugetlb_shm_group=0 >> /usr/lib/sysctl.d/00-system.conf
45             HPAGE_CT=$(printf "%.0f" $(echo 2.2*$hugepage_count | bc))
46             echo vm.max_map_count=$HPAGE_CT >> /usr/lib/sysctl.d/00-system.conf
47             HPAGE_CT=$(($hugepage_count * 2 * 1024 * 1024))
48             echo kernel.shmmax=$HPAGE_CT >> /usr/lib/sysctl.d/00-system.conf
49
50             reboot
51           params:
52             $KERNEL_ARGS: {get_param: ComputeKernelArgs}
53
54 outputs:
55   OS::stack_id:
56     value: {get_resource: userdata}